Академический Документы
Профессиональный Документы
Культура Документы
Mikael Asplund
Real-Time Systems Laboratory Department of Computer and Information Science Linkping University, Sweden The lecture notes are partly based on lecture notes by Calin Curescu, Simin NadjmTehrani, Jrgen Hansson, Anders Trne. They also loosely follow Burns and Welling book Real-Time Systems and Programming Languages. These lecture notes should only be used for internal teaching purposes at Linkping University.
Lecture 2: RM & EDF Mikael Asplund 29 pages
2 of 29
States of a process
Priority-based scheduling
Every task has an associated priority Run task with the highest priority At every scheduling decision moment Examples Rate Monotonic (RM) Static priority assignment Earliest Deadline First (EDF) Dynamic priority assignment And many others
3 of 29
4 of 29
Schedulability Test
Test to determine whether a feasible schedule exists
Sufficient + if test is passed, then tasks are definitely schedulable - if test is not passed, we dont know Necessary + if test is passed, we dont know - if test is not passed, tasks are definitely not schedulable Exact sufficient & necessary at the same time
5 of 29
6 of 29
Assumption
Rate Monotonic
Each process is assigned a (unique) priority based on its period; the shorter the period, the higher the priority
Assumes the Simple task model Fixed priority scheduling Preemptive Unless stated otherwise
7 of 29
8 of 29
Example 1
Assume we have the following task set OBS: not scheduled yet Scheduled with RM
Example 1 (contd)
9 of 29
10 of 29
Example 2
Taskset Period (Ti) WCET (Ci) P1 20 7 P2 50 10 P3 30 5
Ci Ti
N i= 1
N 21 / N 1
Ci Ti
11 of 29
12 of 29
Harmonic periods
Taskset: Exact schedulability test for RM if periods are harmonic:
Example 3
i= 1
i i
C 1 T
Gantt chart:
13 of 29
14 of 29
Why?
15 of 29
16 of 29
A scheduler is optimal if it always finds a schedule when a schedulability test indicates there is one.
Burns, 1991
R i =Ci
jhp i
Ri Tj
Cj
An optimal scheduling algorithm is one that may fail to meet a deadline if no other scheduling algorithm can meet it.
Stankovic et al., 1995
w n+ 1 =Ci i
jhp i
wn i Tj
An optimal scheduling algorithm is guaranteed to always find a feasible schedule, given that a feasible schedule does exist.
Hansson, 1998
Cj
17 of 29
18 of 29
Optimality of RM
If we assume the Simple Process Model for the tasks Increase Ti for some process If your program and environment allows it
19 of 29
20 of 29
RM characteristics
Easy to implement. Drawback: May not give a feasible schedule even if processor is idle at some points.
21 of 29
22 of 29
N i= 1
Ci Ti
23 of 29
24 of 29
Optimality of EDF
Example 4
Consider following task set: WCET (Ci) EDF is optimal among dynamic priority schedulers Deadline (Di = Ti)
P1 P2 2 4 5 7
If we assume the Simple Process Model for the tasks Or a more relaxed one where Di < Ti
25 of 29
26 of 29
Domino Effect
EDF vs. RM
EDF can handle tasksets with higher processor utilisation. Example 4 not schedulable with RMS! EDF has simpler exact analysis RMS can be implemented to run faster at run-time Depends on the OS But they usually like fixed priorities more
27 of 29
28 of 29
Reading material
Chapter 13 in Burns & Wellings Chapter 4 in Butazzo for the proofs of sufficient condition and optimality
Dynamic Scheduling
29 of 29
30 of 29