Simple Dispatch Rules: Greedy Algorithms
Simple Dispatch Rules: Greedy Algorithms
• We will first look at some simple dispatch rules: algorithms for which
the decision about which job to run next is made based on the jobs
and the time (but not on the history of jobs running, or by computing
tentative schedules).
• These are also called greedy algorithms.
Goals:
• To recognize when simple dispatch rules apply.
• To prove that they are the correct algorithm.
• To analyze the running time of the algorithm.
1|| P Cj
Example:
j pj
1 5
2 3
3 10
4 8
5 4
Questions:
• What is the right algorithm?
• What is its running time?
• How do we prove it?
1|| P Cj
Example:
j pj
1 5
2 3
3 10
4 8
5 4
Questions:
• What is the right algorithm? – SPT
• What is its running time?
• How do we prove it?
1|| P Cj
Example:
j pj
1 5
2 3
3 10
4 8
5 4
Questions:
• What is the right algorithm?– SPT
• What is its running time? – O(n log n)
• How do we prove it?
1|| P Cj
Example:
j pj
1 5
2 3
3 10
4 8
5 4
Questions:
• What is the right algorithm?– SPT
• What is its running time? – O(n log n)
• How do we prove it? – Interchange Argument
Basic format of an interchange argument
Comment: Even though the proof is boilerplate, you must provide enough
mathematical detail that shows that your proof applies to the particular
problem and the particular rule!
1|| P wj Cj
j pj wj
1 1 1
Example: 2 3 2
3 7 1
4 10 20
Questions:
• How can we figure out a simple dispatch rule?
• How do we prove it is correct – Exchange Argument
1|| P wj Cj
Example:
j pj wj
1 1 1
2 3 2
3 7 1
4 10 20
Questions:
• How can we figure out a simple dispatch rule?
• How do we prove it is correct – Exchange Argument
Deadlines
• Can be hard (deadlines) or soft (due dates).
• Model Real Time scheduling.
Example 1
j pj dj
1 2 25
2 4 13
3 6 6
4 7 19
5 10 29
Example 2
j pj dj
1 1 5
2 3 6
3 6 7
4 4 15
EDD - Earliest Due date
Theorem If, for an instance, on one machine with processing times and
deadlines, there is a schedule meeting all deadlines, then EDF meets all
deadlines.
What if you can’t meet all deadlines:
Answer:
What if you can’t meet all deadlines:
Answer: YES
• Reason 1. Think about Lmax = t as extending all deadlines by t .
• Reason 2. Interchange argument.
Adding Release Dates. 1|rj |Lmax
j rj pj dj
1 0 5 11
Example 1
2 4 1 6
3 5 1 6
j rj pj dj
1 0 5 11
Example 2
2 4 1 6
3’ 6 1 7
Adding release dates to a completion time problem.
1|rj | Cj
X
j rj pj
Example 1 1 0 100
2 40 1
j rj pj
1 0 100
Example 2
2 40 1
3 101 1