Académique Documents
Professionnel Documents
Culture Documents
Mathieu Delalandre
Depending of the considered systems (Mainframes, Server computers, Personal Computers (PC), Real Time Systems, Embedded systems & Handheld systems, etc. ) schedulers could be designed in different ways:
algorithms features preemptive without deadline no preemptive with deadline both without deadline both both
independants
Scheduling problems
Processus model
process
WT
WT C(t)
context parameters
w0 C(t) C
s t
0 t
T D
D T rk = r0 + kT sk ek (or f) dk = rk + D
relative deadline period the kth release the kth start time the kth end (finishing) time the kth absolute deadline
r0 C
d0
r0+T
context parameters
T D
T D
r0
d0
r1
d1
r2
10 12 -2 15 17 -2
T2 r0 2 d0 9 r1 11 d1 18 r2 20
k 0 1
sk ek Lk Ek 2 8 -1 0 0 0 12 18
C(t)
U = ui =
i =1 i =1
Ci Ti
ch =
C D
n n i =1 i =1
CH = chi =
context parameters
Ci Di
mean processor load factor residual relative (absolute) deadline (0 D(t) D i.e. D(t) = max(d-t,0)) residual load 0 CH (t )
if C (t ) = D (t ) CH (e) = 1
r0 s
t D(t)
D(t) = d-t
CH(t) = C(t)/D(t)
r0 s
T 5
5-6 1-1 4-3
7
6-7 1-1 3-2
8
7-8 1-0 2-1
9
8-9 0-0 1-0 0-Na 1-0
11
9-10
12
15
17
18
20
17-18 1-0 1-0 1819 19-20
10-11 11-12 12-13 13-14 14-15 15-16 16-17 4-4 7-6 4-3 6-5 3-2 5-4 2-1 4-3 1-1 3-2 1-1 2-1
57-50 50-40 40-25 25-33 33-50 50-00 3-3 3-3 3-3 3-2 2-1 1-1
57-66 66-60 60-50 50-33 33-50 50-100 100-Na 3-2 2-2 2-2 2-2 2-1 1-0 0-0
CH(t) decreases when C(t) decreases CH(t) grows when C(t) is constant
8 7 6 5 4 3 2 1 0 0 2 4 6 8 10 12 14 16 18 0,0 0,4 0,2 0,8 0,6 D(t) C(t) CH(t) 1,0
L(t) is constant when the task is running L(t) decreases when the task is waiting
8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 D(t) C(t) L(t)
10
11
Algorithm Rate Monotonic (RM) Deadline Monotonic (DM) Earliest Deadline (ED) Least Laxity (LL)
12
According to T values and RM scheduling, priority order is given to T2 (T=5), T3 (T=10) and T1 (T=20)
0 T1
10
12
14
20
20
13
7 20 9 10
9 10
12
14 15
17
19 20
T1
0 T3
20
9 10
12
14
19 20
14
Algorithm Rate Monotonic (RM) Deadline Monotonic (DM) Earliest Deadline (ED) Least Laxity (LL)
15
According to the D(t) values and the ED scheduling, priority order on the slot[ 0-18] is given to
T D(t) 0-1 7-6 1-2 6-5 2-3 5-4 3-4 4-3 4-5 3-2 5-6 2-1 6-7 1-0 7-8 8-9 9-10 10-11 11-12 12-13 13-14 14-15 15-16 16-17 17-18
8 10
Task with lowest D(t) starts first Once C(t) at zero, we shift to the lowest D(t)
16
We compute the values L(0) i.e. the nominal laxity. According to the L(t) values and the ED scheduling, priority order on the slot[ 0-18] is given to
t L(t) 0-1 4-3 1-2 3-2 2-3 2-2 3-4 2-2 4-5 2-2 5-6 6-7 7-8 8-9 9-10 10-11 11-12 12-13 13-14 14-15 15-16 16-17 17-18
8 10
T2 of lowest laxity L(t) starts, L2(t) is constant when T2 running, L3(t) and L1(t) decrease since T2,T3 are waiting Once C2(t) at zero, We shift to the lowest Li(t), T1 is scheduled first
T3 ends, T2 restarts L3(t) lowest, T3 is scheduled T2 restarts with T=5, L2(t) and L3(t) are equivalent, We consider here the task id T1 > T2 > T3
only T2 restarts T2 et T3 are starting a new period L2(t) < L3(t), T2 is cheduled first
17
18
Sufficient conditions
A set of periodic task is schedulable with the RM, DM, ED and LL algorithms if they respect the following sufficient conditions. A sufficient condition is one that, if satisfied, assures the statement's truth. (i.e. a necessary condition of a statement must be satisfied for the statement to be true).
n
Rate Monotonic
T
i =1
n i =1
Ci
i
n(21 n 1)
n(21 n 1)
Deadline Monotonic
D
n i =1
Ci
i
i.e. mean processor load factor lowest to Earliest Deadline Least Laxity
Ci
i
C T1 T2 T3 1 2 2
D 5 4 7
T 5 7 8
n(21 n 1) = 3 21 3 1 = 0,7798
0,7357 0,7798
0,9857 0,7798 0,9857 1
can be scheduled with Rate Monotonic cant be scheduled with Deadline Monotonic can be scheduled with Earliest Deadline and Least Laxity
C 1 2 2 Ti = 5 + 7 + 8 = 0,7357 i =1 i
n i =1
Ci
i
1 2 2 + + = 0,9857 5 4 7
19
20
Hybrid task set scheduling deals with the both type of (2) Go up: The timetask. Such a scheduling is based on hybrid scheduler, composed of a real-time scheduler combined with a time- sharing level shifts to the real-time one sharing one. Shifting between the two levels is controlled regarding a criterion according to some go-up and go-down criteria.
(1) Go down: The realtime level shifts to the time-sharing one regarding a criterion
Two main approaches exist to design hybrid schedulers (1) Background/joint processing exploits free idle time of the processor to schedule the aperiodic tasks, or to schedule jointly the aperiodic and periodic tasks. (2) Server based processing implements a virtual periodic task (i.e. the server) in charge of scheduling of the aperiodic tasks.
21
Algorithms
Background scheduling
relative
background
RM
FCFS
no
yes
Idle time = 0
relative/strict strict
background background
ED ED
ED ED
no yes
yes yes
Slack Stealing
relative
background
RM
FCFS
yes
L(t)>0
yes
L(t)=0
relative relative
Server server
RM RM
FCFS FCFS
yes yes
polling polling
yes/no yes/no
polling polling
22
23
Algorithms
Aperiodic constraint
scheduler type
periodic aperiodic preemptive criterion Idle time 0 Idle time 0 Da(t) < Dp(t)
Background scheduling
relative
background
RM
FCFS
no
yes
Idle time = 0
relative/strict strict
background background
ED ED
ED ED
no yes
yes yes
Slack Stealing
relative
background
RM
FCFS
yes
L(t)>0
yes
L(t)=0
relative relative
Server server
RM RM
FCFS FCFS
yes yes
polling polling
yes/no yes/no
polling polling
24
Rate Monotonic (2) FCFS (1) If they are no periodic task ready to be executed (2) Whenever a periodic task restarts (1)
T 5 10
Tp1 Tp2
T C(t) C(t)
2-3
3-4
4-5
5-6 2-1
6-7 1-0
7-8
8-9
9-10 10-11 11-12 12-13 13-14 14-15 15-16 16-17 17-18 18-19 2-1 2-2 1-0 2-2 2-1 1-0 2-1 1-0
2-1
1-0
Idle time Ta1 Ta2 Ta3 C(t) C(t) C(t) 2-1 1-1 1-1 1-0 1-1 1-1 2-2 1-1 2-2 1-1 2-2 1-0 2-2 2-2 2-2 2-1 1-0
2 Na 1 Na 2 Na
Ta2 10 Ta3 11
25
Algorithms
Aperiodic constraint
scheduler type
periodic aperiodic preemptive criterion Idle time 0 Idle time 0 Da(t) < Dp(t)
Background scheduling
relative
background
RM
FCFS
no
yes
Idle time = 0
relative/strict strict
background background
ED ED
ED ED
no yes
yes yes
Slack Stealing
relative
background
RM
FCFS
yes
L(t)>0
yes
L(t)=0
relative relative
Server server
RM RM
FCFS FCFS
yes yes
polling polling
yes/no yes/no
polling polling
26
Earliest Deadline (2) Earliest Deadline (1) If they are no periodic task ready to be executed (2) Whenever a periodic task is ready to be executed (1)
C 3 2 1 2 1 1
D 7 4 8
T 20 5 10
Tp2 Tp1
5-6 2-1
6-7 1-0
7-8
8-9
4-3 2-2
1-0
2-1
1-0
4-3 2-1
2-1
6 Na 8 Na 5 Na
6-5 1-1
5-4 1-1
4-3 1-1
3-2 1-0
6-5 1-0
5-4
4-3
3-2
1-0
Ta2 10 Ta3 11
6-5 2-2
5-4 2-2
4-3 2-2
3-2 2-2
2-1 2-1
1-0 1-0 8-7 1-1 7-6 1-1 5-4 2-2 6-5 1-1 4-3 2-2 5-4 1-1 3-2 2-1 4-3 1-1 2-1 1-0 3-2 1-1 1-0 2-1 1-1 1-0 1-0
Ta2 and Ta3 are scheduled according to a ED strategy on the idle time
27
Earliest Deadline (2) Earliest Deadline (1) If the residual deadlines D(t) of periodic tasks are up to the residual deadline D(t) of a given aperiodic task (2) Whenever a residual deadline D(t) of a periodic task becomes lower.
6-7 7-8 8-9 9-10 10-11 11-12 12-13 13-14 14-15 15-16 16-17 17-18
(1)
C 3 2 1 2 1 1
D 7 4 8
T 20 5
Tp2 Tp1
5-6
2-1 2-2
1-0 2-1 3-2 1-0 2-1 2-1 4-3 1-1 2-1 2-2 4-3 1-0 2-2 3-2 2-1 2-1 1-0 1-0 1-1 8-7 1-1 7-6 2-2 5-4 1-1 6-5 2-1 4-3 1-1 5-4 1-0 3-2 2-1 1-0 1-1 4-3 1-0 3-2 2-1 1-0 8-7 1-0 3-2 1-1 7-6 1-1 6-5 1-1 5-4 1-0 4-3 3-2 2-1 1-0 2-2 4-3 2-1 3-2 1-0 2-1
10
6 Na 8 Na 5 Na
Ta2 10 Ta3 11
28
Algorithms
Aperiodic constraint
scheduler type
periodic aperiodic preemptive criterion Idle time 0 Idle time 0 Da(t) < Dp(t)
Background scheduling
relative
background
RM
FCFS
no
yes
Idle time = 0
relative/strict strict
background background
ED ED
ED ED
no yes
yes yes
Slack Stealing
relative
background
RM
FCFS
yes
L(t)>0
yes
L(t)=0
relative relative
Server server
RM RM
FCFS FCFS
yes yes
polling polling
yes/no yes/no
polling polling
29
Rate Monotonic (2) FCFS (1) If the residual nominal laxities Li(t) of periodic tasks are up to zero (2) Whenever a residual nominal laxity Li(t) of a periodic task goes down to zero.
7-8 1-0 2-2 8-9 9-10 10-11 11-12 12-13 13-14 14-15 15-16 16-17 17-18 2-2 3-2 2-2 8-7 2-2 2-1 2-2 7-6 2-2 1-0 2-2 6-5 2-1 0-0 2-2 5-4 1-0 0-0 2-2 4-3 2-2 3-2 2-2 3-2 2-1 2-2 2-2 2-1 1-0 2-2 2-2 1-0
(1)
T 5
Tp1
t C(t) L(t) C(t) Tp2 L(t) Ta1 Ta2 C(t) C(t) C(t)
2-3
3-4
4-5
2 10 2 Na 1 Na 2 Na
2-1 6-6
Ta2 10 Ta3 11
Ta3
30
Algorithms
Aperiodic constraint
scheduler type
periodic aperiodic preemptive criterion Idle time 0 Idle time 0 Da(t) < Dp(t)
Background scheduling
relative
background
RM
FCFS
no
yes
Idle time = 0
relative/strict strict
background background
ED ED
ED ED
no yes
yes yes
Slack Stealing
relative
background
RM
FCFS
yes
L(t)>0
yes
L(t)=0
relative relative
Server server
RM RM
FCFS FCFS
yes yes
polling polling
yes/no yes/no
polling polling
31
Rate Monotonic (2) FCFS (1) Whenever the server starts its period with aperiodic task(s) waiting for him. (2) If the server ends its capacity, or none aperiodic task is waiting
8-9 9-10 10-11 11-12 12-13 13-14 14-15 15-16 16-17 17-18 18-19 2-1 2-2 1-0 2-2 2-1 1-0 2-0
(1)
3 20 2 Na 1 Na 2 Na
Ta2 10 Ta3 11
32
Rate Monotonic (2) FCFS (1) Whenever the server starts its period with aperiodic task(s) waiting for him. (2) If the server ends its capacity, or none aperiodic task is waiting
7-8 0-0 2-1 8-9 0-0 1-0 9-10 10-11 11-12 12-13 13-14 14-15 15-16 16-17 17-18 2-2 2-1 5-4 2-2 1-0 4-3 2-2 0-0 3-2 2-1 0-0 2-1 1-0 0-0 1-0 2-1 5-4 1-1 4-3 1-1 3-2
(1)
3 20 2 Na 1 Na 2 Na
Ta2 10 Ta3 11
Ta5
33