Classical Scheduling Algorithms For Periodic Systems: Peter Marwedel TU Dortmund, Informatik 12 Germany
Classical Scheduling Algorithms For Periodic Systems: Peter Marwedel TU Dortmund, Informatik 12 Germany
Peter Marwedel
TU Dortmund, Informatik 12
© Springer, 2010
Germany
2012 年 12 月 19 日 These slides use Microsoft clip arts. Microsoft copyright restrictions apply.
Structure of this course
modeling repository
3: 8:
ES-hardware 6: Application Test
mapping
4: system 7: Optimization
software (RTOS,
5: Evaluation &
middleware, …) validation & (energy,
cost, performance, …)
T1
T2
p. marwedel,
informatik 12, 2012 - 4-
Periodic scheduling: Scheduling with
no precedence constraints
i di
ci li
t
p. marwedel,
informatik 12, 2012 - 5-
Average utilization: important charac-
terization of scheduling problems:
n
Average utilization: ci
i 1 pi
p. marwedel,
informatik 12, 2012 - 6-
Independent tasks:
Rate monotonic (RM) scheduling
Most well-known technique for scheduling independent
periodic tasks [Liu, 1973].
Assumptions:
All tasks that have hard deadlines are periodic.
All tasks are independent.
di =pi, for all tasks.
ci is constant and is known for all tasks.
The time required for context switching is negligible.
For a single processor and for n tasks, the following
equation holds for the average utilization µ:
n
ci
n(21/ n 1)
i 1 pi
p. marwedel,
informatik 12, 2012 - 7-
Rate monotonic (RM) scheduling
- The policy -
p. marwedel,
informatik 12, 2012 - 8-
Maximum utilization for guaranteed
schedulability
n
ci
n(21/ n 1)
i 1 pi
lim (n(21/ n 1) ln(2)
n
p. marwedel,
informatik 12, 2012 - 9-
Example of RM-generated schedule
p. marwedel,
informatik 12, 2012 - 10 -
Failing RMS
p. marwedel,
informatik 12, 2012 - 11 -
Case of failing RM scheduling
t
Missed Missing computations
deadline scheduled in the next period
p. marwedel,
informatik 12, 2012
leviRTS animation - 12 -
Intuitively: Why does RM fail ?
T1
tt
T2
should be
completed
No problem if p2 = m p1, mℕ :
T1
tt fits
T2
p. marwedel,
informatik 12, 2012 - 13 -
Critical instants
Lemma: For any task, the critical instant occurs if that task
is simultaneously released with all higher priority tasks.
Tn
Ti
cn+2ci t
Delay
Delaymay
mayincrease
increaseififTTi istarts
startsearlier
earlier
Tn
Ti
cn+3ci t
Maximum
Maximumdelay
delayachieved
achievedififTTnnand
andTTi istart
startsimultaneously.
simultaneously.
p. marwedel,
informatik 12, 2012 - 15 -
Critical instants (2)
p. marwedel,
informatik 12, 2012 - 16 -
The case i: pi+1 = mi pi
Ti
Ti+1 t
T’i+1
Used as the higher priority task at the next iteration.
p. marwedel,
informatik 12, 2012 * wrong in the book of 2003 - 17 -
More
Proof of the RM theorem
in-depth:
p1
T1
c1
T2 t
c2
Schedule
Scheduleisis feasible
feasibleifif +c22 ≦
cc11+c ≦pp11 (1)
(1)
Define F=p
Define F= /p11::##of
p22/p ofperiods
periods of
of TT11fully
fullycontained
containedin
in TT22
p. marwedel,
informatik 12, 2012 - 18 -
Case 1: c1 p2 – Fp1
Case
Case1*:1*: cc11 pp22 –– FFpp11
(c
(c1 small
smallenough
enoughto tobebefinished
finishedbefore
before2nd
2ndinstance
instanceof
of TT2))
1 2
T1
T2 t
Fp1 p2
Schedulable
Schedulableifif (F +1)cc11 ++ cc22 pp22
(F+1) (2)
(2)
T1
T2
t
Fp1 p2
Schedulable if F c1 + c2 F p1 (3)
c1+c2 p1 (1)
Multiplying (1) by F yields F c1+ F c2 F p1
Since F 1: F c1+ c2 F c1+ Fc2 F p1
Same statement as for case 1.
p. marwedel,
informatik 12, 2012 - 21 -
Calculation of the least upper
utilization bound
p. marwedel,
informatik 12, 2012 - 22 -
Case 1: c1 p2 – Fp1
T1
T2 t
Fp1 p2
Largest possible value of c2 is c2= p2 – c1 (F+1)
Corresponding upper bound is
c1 c2 c1 p2 – c1 ( F 1) c1 c1 ( F 1) c1 p2
U ub 1 1 ( F 1)
p1 p2 p1 p2 p1 p2 p2 p1
p. marwedel,
informatik 12, 2012 - 23 -
Case 2: c1 p2 – Fp1
T1
T2
t
Fp1 p2
1 G2
U ub
1 G
Using derivative to find minimum of U ub :
dU ub 2G (1 G ) (1 G 2 ) G 2 2G 1
0
dG (1 G ) 2
(1 G ) 2
G1 1 2; G2 1 2;
Considering only G2 , since 0 G 1 :
1
1 ( 2 1)2 4 2 2
U lub 2( 2 1) 2(2 2 1) 0.83
1 ( 2 1) 2
p. marwedel,
informatik 12, 2012 - 26 -
Properties of RM scheduling
p. marwedel,
informatik 12, 2012 - 27 -
EDF
p. marwedel,
informatik 12, 2012 - 28 -
Comparison EDF/RMS
RMS:
EDF:
p. marwedel,
informatik 12, 2012 - 30 -
Comparison RMS/EDF
RMS EDF
Priorities Static Dynamic
Works with OS with fixed Yes No*
priorities
Uses full computational No, Yes
power of processor just up till µ=n(21/n-1)
p. marwedel,
informatik 12, 2012 - 32 -
Dependent tasks
Strategies:
1. Add resources, so that scheduling becomes easier
2. Split problem into static and dynamic part so that only a
minimum of decisions need to be taken at run-time.
3. Use scheduling algorithms from high-level synthesis
p. marwedel,
informatik 12, 2012 - 33 -
Summary
Periodic scheduling
Rate monotonic scheduling
EDF
Dependent and sporadic tasks (briefly)
p. marwedel,
informatik 12, 2012 - 34 -