You are on page 1of 23

CprE 458/558: Real-Time Systems

Scheduling Results & RMS and EDF Schedulers

CprE 458/558: Real-Time Systems (G. Manimaran)

Understanding Fundamentals
Understanding the boundary between polynomial and NP-complete problems can provide insights into developing useful heuristics. Understanding the algorithms that achieve some of the polynomial results can again provide basis for developing heuristics.
CprE 458/558: Real-Time Systems (G. Manimaran) 2

Understanding Fundamentals (cont.) Understanding the fundamental limitations of on-line algorithms will help designers avoid scheduling anomalies and misconceptions.

CprE 458/558: Real-Time Systems (G. Manimaran)

Performance Metrics
Minimizing Schedule Length. Minimizing Sum of Completion Times. Maximizing Weighted Sum of Values (Useful in RT systems). Minimizing the Maximum Lateness (useful in RT systems).

CprE 458/558: Real-Time Systems (G. Manimaran)

Uniprocessor - some results


One processor, Non-preemptive, Minimizing the Max. Lateness (Polynomial). One processor, Non-preemptive, release time constraint, Minimizing the Max. Lateness (NPhard). One processor, Preemptive, release time constraint, Minimizing the Max. Lateness (Polynomial).
CprE 458/558: Real-Time Systems (G. Manimaran) 5

Uniprocessor - more results


Result: When there are mutual exclusion constraints, it is impossible to find a totally online optimal scheduler. Result: The problem of deciding whether it is possible to schedule a set of periodic tasks that use semaphores only to enforce mutual exclusion in NP-hard. Overload Result: There does not exist an online scheduling algorithm with a competitive factor greater than 0.25. (this is for general case: arbitrary number of processors).
CprE 458/558: Real-Time Systems (G. Manimaran) 6

Multiprocessor Some Results


Result: The multiprocessor scheduling on P processors with task preemption allowed and with minimization of the number of late tasks is NP-hard. Result: For two or more processors, no deadline scheduling algorithm can be optimal without complete a prior knowledge of deadlines, computation times, and task ready times.

CprE 458/558: Real-Time Systems (G. Manimaran)

Multiprocessor more results


EDF is not optimal in the multiprocessor case. No on-line scheduling algorithm can guarantee a cumulative value greater than one half for the dual processor case. (A special case of overload result)

CprE 458/558: Real-Time Systems (G. Manimaran)

Multiprocessor; Single Deadline; Non-premptive

NP-completeness is mainly due to non-uniform task execution time and resource constraints.
CprE 458/558: Real-Time Systems (G. Manimaran) 9

Multiprocessing Anomalies
Assume that a set of tasks is optimally schedulable on a multiprocessor with some priority order, a fixed number of processors, fixed computation times, and precedence constraints. Result: For the stated problem, changing the priority list, increasing the number of processors, reducing the computation times, or weakening the precedence constraints can increase the schedule length.

CprE 458/558: Real-Time Systems (G. Manimaran)

10

Multiprocessing Anomalies (cont.)


These anomalies may cause some of the already guaranteed tasks to miss their deadlines. It can be shown that run-time anomalies cannot occur in a multiprocessor schedule when the tasks are independent.

CprE 458/558: Real-Time Systems (G. Manimaran)

11

Run-time Anomaly
Run-time anomaly may occur when the actual computation time of a task differs from its worst case computation time in a nonpreemptive multiprocessor schedule with resource constraints. A processor is said to be work conserving if it is never idle when there is a task to execute. Any work conserving scheme may lead to run-time anomaly.

CprE 458/558: Real-Time Systems (G. Manimaran)

12

Run-time Anomaly Example


Example: Ti=(ai ,ci ,di ) T1=(0,20,22); T2=(0,12,25); T3=(10,8,26);T4=(8,10,30). T3 and T4 have resource conflicts; Actual computation time of T1 is 10.

CprE 458/558: Real-Time Systems (G. Manimaran)

13

Priority-driven Preemptive Scheduling


Assumptions & Definitions Tasks are periodic No aperiodic or sporadic tasks Job (instance) deadline = end of period No resource constraints Tasks are preemptable
C Laxity of a Task t Ti = di (t + ci) where di: deadline; t : current time; ci : remaining computation time.
i

di
Laxity

CprE 458/558: Real-Time Systems (G. Manimaran)

14

Rate Monotonic Scheduling (RMS) Schedulability check (off-line)


- A set of n tasks is schedulable on a uniprocessor by the RMS algorithm if the processor utilization (utilization test):

The term n(21/n -1) approaches ln 2, (}0.69 as n p g).


- This condition is sufficient, but not necessary.
CprE 458/558: Real-Time Systems (G. Manimaran) 15

RMS (cont.) Schedule construction (online)


- Task with the smallest period is assigned the highest priority. - At any time, the highest priority task is executed. RMS is an optimal preemptive scheduling algorithm with fixed priorities. Static/fixed priority algorithm assigns the same priority to all the jobs (instances) in each task.
CprE 458/558: Real-Time Systems (G. Manimaran) 16

RMS Scheduler -- Example 1


Task set: Ti = (ci, pi) T1 = (2,4) and T2 = (1,8) Schedulability check: 2/4 + 1/8 = 0.5 + 0.125 = 0.625 2(2 -1) = 0. 82
Active Tasks : {T1, T2} Active Tasks : {T2} Active Tasks : {T1}

T11 0 2

T21 3 4

T12 6 8

CprE 458/558: Real-Time Systems (G. Manimaran)

17

RMS scheduler -- Example-2


Task set: Ti = (ci, pi) T1 = (2,4) and T2 = (4,8) Schedulability check: 2/4 + 4/8 = 0.5 + 0.5 = 1.0 > 2(2 -1) = 0. 82
Active Tasks : {T1, T2} Active Tasks : {T2} Active Tasks : {T2, T1} Active Tasks : {T2}

T11 0 2

T21 3 4

T12 6

T21 8

Some task sets that FAIL the utilization-based schedulability test are also schedulable under RMS We need exact analysis (necessary & sufficient) CprE 458/558: Real-Time Systems (G. Manimaran) 18

Earliest Deadline First (EDF)


Schedulability check (off-line) - A set of n tasks is schedulable on a uniprocessor by the EDF algorithm if the processor utilization.

This condition is both necessary and sufficient. - Least Laxity First (LLF) algorithm has the same schedulability check.
CprE 458/558: Real-Time Systems (G. Manimaran) 19

EDF/LLF (cont.)
Schedule construction (online) EDF/LLF: Task with the smallest deadline/laxity is assigned the highest priority. At any time, the highest priority task is executed. EDF/LLF is an optimal preemptive scheduling algorithm with dynamic priorities. Dynamic priority algorithm assigns different priorities to the individual jobs (instances) in each task.
CprE 458/558: Real-Time Systems (G. Manimaran) 20

EDF scheduler -- Example


Task set: Ti = (ci, pi, di) T1 = (1,3,3) and T2 = (4,6,6)

Schedulability check: 1/3 + 4/6 = 0.33 + 0.67 = 1.0 Active Tasks : {T2} Active Tasks : {T2, T1} Active Tasks : {T1}

Active Tasks : {T1, T2}

T11 0 1

T21 3

T21 5

T12 6

Unlike RMS, Only those task sets which pass the schedulability test are schedulable under EDF CprE 458/558: Real-Time Systems (G. Manimaran) 21

RMS vs. EDF/LLF


RMS is an optimal preemptive scheduling algorithm with fixed priorities. EDF/LLF is an optimal preemptive scheduling algorithm with dynamic priorities. RMS schedulability properties can be analyzed; rich theory exists and it is widely used in practice. EDF/LLF offers higher schedulability than RMS, but it is more difficult to implement.
CprE 458/558: Real-Time Systems (G. Manimaran) 22

RMS & EDF -- Example


EDF schedule
T1
0 5 10 15 20 25 30 35

Process Period, T T1 5 T2 7

WCET, C 2 4

T2
0 7 14 21 28 35

RMS schedule
T1 0 T2 0 7 14 21 28 23 35 CprE 458/558: Real-Time Systems (G. Manimaran) 5 10 15 20 25 30

Deadline miss

35