Professional Documents
Culture Documents
Preemptive scheduling
Most of work on scheduling has been focused on
fully preemptive systems, because they allow higher
responsiveness:
Preemptive
Non Preemptive
However, each preemption has a cost: CRPD: delay introduced by high priority tasks that evict
cache lines containing data used in the future:
Context switch cost: time taken by the scheduler
to suspend the running task, switch the context, Cache
write B
and dispatch the new incoming task.
1
A
B
2
i CRPD Pipeline
context
Bus
switch
NP
Ci
WCETi
Ci = CiNP + CRPD
1
29/10/2019
Non Preemptive
WCET
Preemptive
WCET
+35%
2
0 7 14 21 28 35
deadline miss
NP-RM deadline deadline
miss miss
1
0 5 10 15 20 25 30 35
2
0 7 14 21 28 35
2
29/10/2019
C1 =
3
1
T1 double speed
2 deadline miss
C2 = T1 T2 1
2
C2
U = + 0 3
T1
2 2
0 10 20 30 0 10 20 30
3 3
3
29/10/2019
2
2
i threshold priority: used for task execution (i Pi) 5 deadline miss
3
0 2 4 6 8 10 12 14 16 18
deadline miss
threshold
1
2
non preemptive
nominal
2
2
Fully
by h only if Ph > i 0 2 4 6 8 10 12 14 16 18
2 3 2 2
Pi
sik fik
3
5
1 2 sik
sik Bi (k 1)Ci
h:Ph Pi Th
1 Ch
NOTE:
The same feasible schedule is obtained by splitting 3 in f s
two non preemptive chuncks: q31 = 2, q32 = 3 f ik sik Ci Th
ik
ik 1 Ch
Th
h:Ph i
4
29/10/2019
Each task can defer preemption up to qi Given a preemptively feasible task set, find the
longest non-preemptive interval Qi for each task
that still preserves schedulability.
i Ck Bi It must be i Bi i
U lub (i )
k 1 Tk Ti
where Bi max{q j }
Pj Pi
i
i Ti U lub (i ) U k
k 1 Hence: i max{q j } i
Pj Pi
5
29/10/2019
1
0 6 12 18 24
2
0 9 18 27
3
Note that:
The worst case response time of 2 does not occur in
Bi max{q max
j }
the first instance.
Pj Pi The interference on 2 is larger than B2 + C1.
2
1
0 9 18 27
0 6 12 18 24
3
2
0 9 18 27
3 Busy period of 2
Level-i busy period
Busy period of 2 It can be computed as the shortest interval that satisfies:
Li up to job Ni:
Level-i busy period Li B i Th
Ch
Li
It is the interval in which the processor is busy executing h : Ph Pi
Ni
tasks with priority higher than or equal to Pi, including Ti
blocking times. Initial value can be: L(i 0 ) B i
h : Ph Pi
Ch
6
29/10/2019
f ik sik q last
sik
sik Bi (k 1)Ci Ci qilast 1 Ch
i
h:Ph Pi
Rik f ik (k 1)Ti
T h
if (Rik > Ri) then Ri = Rik
f ik sik qilast
Rik f ik ( k 1)Ti
s ( 0)
ik
(k 1)Ti Ci q
last
i if (Ri > Di) then return(UNFEASIBLE)
k++
NOTE: } while (k Ni)
Li }
Ri max Rik Ni
Ti return(FEASIBLE)
k[1, N i ]