Priority Driven Approaches There are three priority driven approaches that we will look at Earliest-Deadline-First (EDF) Least-Slack-Time-first (LST) Latest-Release-Time-first (LRT) 1
EDF Earliest deadline first (EDF) assigns higher priority to jobs that have earlier deadlines. In the jobs below the execution time is given first followed by the release time then deadline, 3 (0,6], 2 (2,8], 2 (2,7] 0 2 4 6 8 2
LST Least slack time first (LST) assigns higher priority to jobs that have lower slack times. At any time, t, the slack (or laxity) of a job is equal to d t minus the time required to complete the remaining portion of the job, 3 (0,6], 2 (2,8], 2 (2,7] 0 2 4 6 8 3
LRT Latest release time (LRT), or reverse EDF, treats release times as deadlines and deadlines as release times. It schedules the jobs backwards, starting from the latest deadline of all jobs. The later the release time, the higher the priority. It is not a true priority driven algorithm, 3 (0,6], 2 (2,8], 2 (2,7] 0 2 4 6 8 4
EDF The EDF algorithm is optimal. When preemption is allowed and jobs do not content for resources, the EDF algorithm can produce a feasible schedule of a set J of jobs with arbitrary release times and deadlines on a processor if and only if J has feasible schedules Proof: any feasible schedule of J can be systematically transformed into and EDF schedule 5
EDF: Proof of Optimality I 1 I 2 J i J k (a) r k d k d i J k J k J i (b) J k J k J i (c) 6
EDF: Proof of Optimality There are two cases to consider Case 1 r k is later than the end of I 1 nothing to do. Jobs are scheduled according to EDF Case 2 r k is before the beginning of I 1, (a) swap J k with J i If I1 is shorter than I2, do as in previous slide, (b) If I1 is longer than I2, Jk and Ji scheduled in I 1 and rest of J i in I 2 repeat for all such pairs eliminate idle intervals, as in previous slide, (c) 7
EDF: Proof of Optimality The preemptive EDF algorithm can always produce a feasible schedule as long as feasible schedules exist follows straightforwardly from the fact that every feasible schedule can be transformed into a preemptive EDF schedule If the EDF algorithm fails to produce a feasible schedule, then no feasible schedule exists 8
non optimality of EDF EDF is optimal only when preemption is allowed r 1 r 2 r 3 J 3 misses its deadline 0 0 2 4 6 8 10 12 14 2 4 6 8 10 12 14 r 1, r 2, r 3 = 0, 2, 4 e 1, e 2, e 3 = 3, 6, 4 d 1, d 2, d 3 = 10, 14, 12 9
non optimality of EDF EDF is optimal only for single processor systems misses its deadline P 1 0 2 4 6 P 2 P 1 r 1, r 2, r 3 = 0, 0, 0 e 1, e 2, e 3 = 1, 1, 5 d 1, d 2, d 3 = 1, 2, 5 0 2 4 6 P 2 10
Priority driven approach Pros Easy to implement run-time overhead small minimal information needed Cons Timing behaviour is non-deterministic when job parameters vary, i.e. it is difficult to validate deadlines 11
The validation problem Given: the set of jobs, the set of resources, and the scheduling algorithm to allocate processors and resources to jobs, determine whether all the jobs meet their deadlines 12
Scheduling anomalies Consider a system of four jobs with priority order,, and J 4, with having the highest priority Jobs may be preempted but never migrated, i.e. once a job is started on a processor it is constrained to complete on that processor 's deadline can vary Execution times, deadlines and release times are on the next slide 13
Scheduling anomalies r 1 d 1 [e i-, e i+ ] J 4 0 10 5 0 10 [2, 6] 4 15 8 0 20 10 14
Scheduling anomalies Problem: Does the system meet all the deadlines and is the completion time jitter (i.e., the difference between the latest and earliest completion times) of every job is no more than 4. 15
0 5 10 15 20 P 1 P 2 J 4 6 16 (a) P 1 P 2 J 4 2 20 J 4 (b) P 1 P 2 J 4 3 21 J 4 (c) P 1 P 2 J 4 (d) 5 15
Scheduling anomalies Priority driven schedules (a) and (b) are for e 2 = 6 and e 2 = 2 respectively. One might say that all jobs meet their deadlines and completion time jitter is small As far as J 4 is concerned, worst case schedule is (c), with e 2 = 3, J 4 misses its deadline Best case schedule, wrt J 4 is (d), however the completion time jitter = 5 (>4) 17
Scheduling anomalies Conclusion to find the best-case and worst-case schedules, we must try all possible values of e 2 A scheduling anomaly is an unexpected timing behaviour of priority driven system 18
Off-line vs On-line scheduling Off-line scheduling algorithm Pros inflexible can be applied only to deterministic systems Cons complexity of the algorithm can be ignored 19
Off-line vs On-line scheduling On-line scheduling algorithm Pros can accommodate dynamic variations in user demands and resource availability requires no knowledge of jobs that will be released in the future Cons Without prior knowledge about future jobs, the scheduler cannot make optimal scheduling decisions requires an acceptance test for new jobs 20
On-line scheduling r 1, r 2 = 0, x where x < 1 and is non preemptable e 1, e 2 = 1, 1-x d 1, d 2 = 2, 1 x 0 1 2 on-line scheduler: will miss deadline 0 1 2 clairvoyant scheduler: delays until J2 released 21
On-line scheduling r 1, r 2 = 0, x where x < 1 and is non premptable e 1, e 2 = 1, 1 d 1, d 2 = 2, 2 x 0 1 2 on-line scheduler: will miss deadline 0 1 2 clairvoyant scheduler: starts first 22
Overloaded systems A system is said to be overloaded when the jobs offered to the scheduler cannot be feasibly scheduled even by a clairvoyant scheduler When a system is not overloaded, an optimal on-line scheduling algorithm is one that always produces a feasible schedule of all offered jobs No optimal on-line schedule exists when some of the jobs are non preemptable 23
Performance measure The value of a job v(j) = e j if it completes by the deadline, otherwise v(j) = 0 The value of a schedule of a sequence of jobs V son = v(j); for all j An on-line algorithm has a competive factor c, if and only if V son = c * V clair Using this measure, EDF and LST are optimal when the jobs are preemptable and no overload exists 24
Performance measure EDF and LST both have competive factors of 1, under no overload Under overload, both of their competive factors are 0 e r 1, r 2 e 1, e 2 d 1 = 0, e = 2e, e = e, D 1 = e 0 2e Maximum possible competive factor achievable is e 25