paper discussion
DESCRIPTION
C. L. Liu and James W. Layland , "Scheduling Algorithms for M u ltiprogramming in a Hard-Real-Time Environment", JACM, Vol 20, No. 1, pp. 46--61, 1973 - PowerPoint PPT PresentationTRANSCRIPT
資工系網媒所 NEWS實驗室/521
Paper Discussion
C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment", JACM, Vol 20, No. 1, pp. 46--61, 1973 Chihg-Chih Han, Kwei-Jay Lin and Chao-Ju Hou, "Distance-Constrained Scheduling and Its Applications to Real-Time Systems", IEEE Trans. on Computers, Vol 45, No. 7, pp. 814-826 1996
資工系網媒所 NEWS實驗室/522
Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment
No non-time-critical jobsPure Process Control
C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment", JACM, Vol 20, No. 1, pp. 46--61, 1973
資工系網媒所 NEWS實驗室/523
Assumptions
(A1) The requests for all tasks for which hard deadlines exist are periodic, with constant interval between requests.
(A2) Deadlines consist of run-ability constraints only--i.e, each task must be completed before the next request for it occurs.
(A3) The tasks are independent in that requests for a certain task do not depend on the initiation or the completion of requests for other tasks.
(A4) Run-time for each task is constant for that task and does not vary with time. Run-time here refers to the time which is taken by a processor to execute the task without interruption.
(A5) Any nonperiodic tasks in the system are special; they are initialization or failure-recovery routines; they displace periodic tasks while they themselves are being run, and do not themselves have hard, critical deadlines.
資工系網媒所 NEWS實驗室/524
Real-Time Task Model
Periodic Task Modelparameters are known a priori
worst-case execution time
period
request time ready time deadline start finish preempt resume
Predictability vs. Schedulabilityhigh predictability and schedulabilityeasy-to-check schedulability condition
資工系網媒所 NEWS實驗室/525
Time-Driven Scheduling Approachwidely used inflexible, efficientlarge space needed
e.g. cyclic executive
Priority-Driven Scheduling Approachdynamic-priority
e.g. earliest deadline first fixed-priority
e.g. rate monotonic
0 3 6
0 3 6
Scheduling Approaches
資工系網媒所 NEWS實驗室/526
Terms in Scheduling
job: an instance of a taskdeadline: next request time of the same taskoverflow at time t: t is a deadline of unfulfilled requestfeasible: scheduled with no overflow (schedulable)response time: time span from request to finishcritical instance: an instance when a request will have the largest response timecritical time zone: time interval from a critical instance to its finish time
資工系網媒所 NEWS實驗室/527
A Fixed Priority Scheduling Algorithm
THEOREM 1. A critical instant for any task occurs whenever the task is requested simultaneously with requests for all higher priority tasks.
A scheduling algorithm is feasible if all tasks can be fulfilled at their critical instants.
資工系網媒所 NEWS實驗室/528
A Fixed Priority Scheduling Algorithm (cont.)
THEOREM 2. If a feasible priority assignment exists for some task set, the rate-monotonic priority assignment is feasible for that task set.
資工系網媒所 NEWS實驗室/529
Optimality
THEOREM 2. If a feasible priority assignment exists for some task set, the rate-monotonic priority assignment is feasible for that task set.
資工系網媒所 NEWS實驗室/5210
A Fixed Priority Scheduling Algorithm (cont.)
THEOREM 3. For a set of two tasks with fixed priority assignment, the least upper bound to the processor utilization factor is U = 2 (2 ½ - 1).case 1
case 2
T1
T2
T1
T2
資工系網媒所 NEWS實驗室/5211
A Fixed Priority Scheduling Algorithm (cont.)
The minimum U occurs at the boundary of two cases
T1
T2
T1
T2
資工系網媒所 NEWS實驗室/5212
Least Upper Bound
An easy-to-check schedulability condition
1
)12( /1 mmn=2, 0.83
n=3, 0.78
n=, 0.69
)/(1
i
m
ii TCU
資工系網媒所 NEWS實驗室/5213
A Fixed Priority Scheduling Algorithm (cont.)
THEOREM 4. For a set of m tasks with fixed priority order, and the restriction that the ratio between any two request periods is less than 2, the least upper bound to the processor utilization factor is U = m(2 1/m - 1).find optimal conditions
when optimality exists or if it is optimal and condition A does not hold
conflicts, so A must be true.solve equations at optimal condition
derive boundrelax assumption
資工系網媒所 NEWS實驗室/5214
T1
T2
T1
T2
T1
T2
T1
T2
資工系網媒所 NEWS實驗室/5215
資工系網媒所 NEWS實驗室/5216
A Fixed Priority Scheduling Algorithm (cont.)
THEOREM 5. For a set of m tasks with fixed priority order, the least upper bound to processor utilization is U = m(2 1/m - 1).
The bound of special case is tighter than general case.Rate Monotonic Priority Assignment
The smaller the period, the higher the priority.Rate Monotonic Scheduling Algorithm
generate the whole scheduleon-lineoff-line
priority queue100%?
資工系網媒所 NEWS實驗室/5217
A Deadline Driven Scheduling Algorithm
THEOREM 6. When the deadline driven scheduling algorithm is used to schedule a set of tasks on a processor, there is no processor idle time prior to an overflow.
資工系網媒所 NEWS實驗室/5218
A Deadline-Driven Scheduling Algorithm (cont.)
THEOREM 7. For a given set of m tasks, the deadline driven scheduling algorithm is feasible if and only if U 1.
necessary condition (only if)if feasible, the computation demand processor time
sufficient conditionif U 1,
and not feasiblecase 1
0 T T1 T2…Tm
all bi beyond T
資工系網媒所 NEWS實驗室/5219
Sufficient Condition (cont.)case 2
some bi were carried out before T
資工系網媒所 NEWS實驗室/5220
A mixed Scheduling Algorithm?
資工系網媒所 NEWS實驗室21
video serverinter-frame distance must be less than 33ms
robot arm movementneeds steady and smooth operations
satellite/cellular phone trackingservice in constant time interval
more predictable inter-execution time than the periodic task(PT) model
worst inter-execution time for PT is 2xperiod-ei
Distance-Constrained Task Model
Chihg-Chih Han, Kwei-Jay Lin and Chao-Ju Hou, "Distance-Constrained Scheduling and Its Applications to Real-Time Systems", IEEE Trans. on Computers, Vol 45, No. 7, pp. 814-826, 1996
資工系網媒所 NEWS實驗室/5222
Pinwheel Problem
Given a multiset A={a1, a2, ... ,an}, ai Î NFind an infinite sequence of symbols from {1, 2, ... , n} such that at least one symbol i within any interval of ai symbolsA={2,3} ® 1 2 1 2 1 2 ...
® 1 1 2 1 1 2 ...A unit-time schedule
資工系網媒所 NEWS實驗室/5223
Pinwheel schedule 0 1 2 3 4 5 6 7 8 9 10 11 12
0 1
4
567
8
9
10
11
3
2
12
T1 (1,6)
T2 (3,6)
T4 (2,12)
T3 (2,12)
6
T2
T4T1
T1T3
T2
6 6 6 6 6 6
Pinwheel Schedule
資工系網媒所 NEWS實驗室/5224
Pinwheel Transformation
Pinwheelany numbers ® multiples
jitterless, predictable
Signalanalog ® digital
noiseless, ease of controle.g. CD music
2E.g. A={3,4,6,13} ® {3} B ={3,3,6,12} ={3,3,3×21, 3×22}• single-number reduction
30 6 9
A
B
12
(RM)
(PW)
資工系網媒所 NEWS實驗室/5225
Pinwheel Scheduling Properties
Good jitter control in schedulesEasy-to-check schedulabilityPredictable resource accessesEasy extension for aperiodic tasksPredictable end-to-end delayNetwork scheduling (INFOCOM’95 by Han & Shin)Flexible time-driven approach
資工系網媒所 NEWS實驗室/5226
Pinwheel Scheduler
Given a multi-set of distance constraints of n tasksA={a1, a2, ... ,an}, density r(A) Si
(1/ai )Find another B={b1, b2, ... ,bn}, "i, bi ai ,A is schedulable if B is schedulable.If bi’s are multiples (bi|bj) and r(B) 1, B is schedulable.E.g. A={3,4,6,7} ®(specialized) B ={3,3,6,6}schedule is “1 2 3 1 2 4 1 2 3 1 2 4 ...”The goal is to minimize density increase
資工系網媒所 NEWS實驗室27
Previous Works
Sa:x=a1 , dSa ³ 0.5
Sx: a1 /2 < x a1 , dSx ³ 0.65
S23:use 2 and 3, dS23 ³ 7/12 @ 0.58
Sbc: b=a1 , b c < 2bdSbc ³ 2/3 @ 0.67
CX: the set of all instances schedulable by Scheduler x
CS23
CSx
CSa
CSbc
dX: the schedulable density bound for Scheduler x
資工系網媒所 NEWS實驗室/5228
Single-node Pinwheel Scheduling
Earlier work: use a base of 2 , find x in (a1/2 , a1] Sa, Sx, Sbc, Sby, Sxy: 0.5, 0.65, 2/3, …distance constraints of integer, unit execution time
Sr: use a base of 2 , find r in (a1/2 , a1] real-number distance constraints and execution times
Our contributions:Srg: use a base of gSrb: try all bases (optimal for single-number reduction)HSr: near-optimal polynomial-time heuristicInteger Pinwheel Scheduling: Sxg, Sxb , HSx
資工系網媒所 NEWS實驗室/5229
Various Pinwheel Schedulers
distance constraint g=2 optimal g near optimal
heuristic x is an integer Sx Sxb HSx
r is a real number Sr Srb HSr
資工系網媒所 NEWS實驗室/5230
Multiple-Node Scheduling
All nodes are specialized with the same base using DSr (Distributed Sr Scheduling)Pinwheel phase alignmentMinimize the total end-to-end delayMinimize the maximum end-to-end delay
Pinwheelj Pinwheel1 Pinwheel2 Pinwheelm ...
Nodej N1 N2 Nm ...
...
資工系網媒所 NEWS實驗室/5231
a = {(1,2),(1,3)}b = {(1,2.1),(2.1,6)}c = {(1,1.9),(1,4)}d = {(1,2),(2.1,6)}e = {(1,1.9),(2.1,6)}f = {(1,2),(1.1,3)} : Jitterless
Relationships of Pinwheel Schedulers
CX: the set of all instances schedulable by Scheduler x
CSrb
CSxCSr CSxba.
b.
e.
d.c.
f.
資工系網媒所 NEWS實驗室/5232
Synchronous Scheduling
Intranode: pinwheel scheduling makes task executions regular and predictable, i.e. no jitter.Internode: in all nodes, transform the periods of all tasks to harmonic numbers so that tasks of the same period are synchronized. The worst case delay for a task between its arrival and the beginning of its execution on a node is one period.
Nodej N1 N2 Nm ...
...
資工系網媒所 NEWS實驗室/5233
資工系網媒所 NEWS實驗室/5234
資工系網媒所 NEWS實驗室/5235
Simplification
資工系網媒所 NEWS實驗室/5236
Study of Pinwheel Scheduling
n tasks are schedulable on a node (using HSr) if the total utilization is n (21/n - 1). n tasks are schedulable on all nodes (using DSr) if the utilization on any node is 21/n-1.Algorithm of O(n log n + nl) to minimize the total or maximum task delay between two nodes with l different periods. Algorithm of O(mn log n + mnl) to minimize the total end-to-end delay on m nodes.Polynomial heuristics to reduce the maximum end-to-end delay on m nodes.
資工系網媒所 NEWS實驗室/5237
Time-driven Scheduling Approach
Off-lineconstruct complete schedule
exponential time and spacegenerate effective time parameters
start time, resume time, finish timeoptimization
On-lineexecute tasks according to off-line generated schedule or parameters, inflexible
0 3 6
資工系網媒所 NEWS實驗室/5238
SSr: Pinwheel Schedule ConstructorGenerate start times and finish times in O(n2)
task5
5.30 10.6 15.9
task1
21.2
task2
task3
task4
資工系網媒所 NEWS實驗室/5239
Generate effective pinwheel schedule.
Use an on-line scheduler to schedule tasks according to the effect schedule.
Time-Driven Pinwheel Scheduling
Generate start times and finish times using SSrNext resume time can be found in O(n)
the latest finish time of the preempting tasks
task1
task2
task3
task4
資工系網媒所 NEWS實驗室/5240
TOPS:Time-driven On-line Pinwheel Scheduler
scheduler TOPS-c(constant)
TOPS-l(linear)
TOPS-f(flexible)
TOPS-m(mix)
off-linegenerates S*,F*,R* S,F S,F,
priorityon-line
generates R S,F,R
on-line timecomplexity O(1) O(n) O(n)** O(log n)
spacecomplexity O(bn/b1) O(n) O(n) O(n)
*S:start time, F:finish time, R:resume time; * * amortized
資工系網媒所 NEWS實驗室/5241
Pinwheel Transformation
Sr: d ={(1,2),(2.1,6)} ®{(1,2),(2.1,4)}
20 4 6
overflow
Sxb: d ={(1,2),(2.1,6)} ®{(1,2),(2.1,6)}
8
資工系網媒所 NEWS實驗室/5242
PX: the set of all periodic task sets schedulable by Scheduler xCX: the set of all DCTS’s schedulable by Scheduler x
a = {(1,2),(1,3)}b = {(1,2),(0.5,3),(1,7)}c = {(1,2),(1,3),(1,7)}d = {(1,2),(1.1,3)}e = {(1,2),(2,3)}
PEDF
PRM
a.b.
c.d.
e.
CSrb
PRM = CSrb
n 2
Relationship between CSrb, PRM , and PEDF
資工系網媒所 NEWS實驗室/5243
a = {(1,2),(1,3)}b = {(1,2.1),(2.1,6)}c = {(1,1.9),(1,4)}d = {(1,2),(2.1,6)}e = {(1,1.9),(2.1,6)}f = {(1,2),(1,3),(1,7)}g = {(1,2),(1.1,3)} : Jitterless
Relationships of SchedulersCX: the set of all instances schedulable by Scheduler x
CRM
CSrb
CSxCSr CSxba.b.
e.
d.c.
f.g.
資工系網媒所 NEWS實驗室44
Examples of Schedulers
CRM
CSrb
CSx
CSr CSxba.
b. d.c.
a = {(1,2),(1,3)}, r @ 0.83[Sx] {(1,2),(1,2)}, F 1
b = {(1,2.1),(2.1,6)}, r @ 0.83[Sx] {(1,2),(2.1,4)}, F @ 1.03[Sr] {(1,2.1),(2.1,4.2)}, F @
0.98[Sxb] {(1,2),(2.1,6)} , F 0.85
c = {(1,1.9),(1,4)}, r @ 0.78[Sr] {(1,1.9),(1,3.8)} , F @ 0.79[Sxb] {(1,1),(1,4)} , F 1.25
d = {(1,2),(2.1,6)}, r 0.85
[Sr] {(1,1.5),(2.1,6)}, F @ 1.02[Sxb] {(1,2),(2.1,6)}, F 0.85
資工系網媒所 NEWS實驗室/5245
More Examples of Schedulers
e = {(1,1.9),(2.1,6)}, r @ 0.88[Sr] {(1,1.5),(2.1,6)}, F @ 1.02[Sxb] {(1,1),(2.1,6)}, F 1.35[Srb] {(1,1.9),
(2.1,5.7)}, F @ 0.89
f = {(1,2),(1,3),(1,7)}, r @ 0.97[Srb] {(1,2),(1,2),
(1,6)}, F @ 1.17
g = {(1,2),(1.1,3)}, r @ 0.87
CRM
CSrb
CSxCSr
CSxb
e.f.
g.
資工系網媒所 NEWS實驗室/5246
Comparison of Schedulers
Scheduler EDF RM Srb
schedulabilitycondition 1 n (21/n - 1) n (21/n - 1)
jitter high low* none
end-to-end delay long short shortest
resource reservation difficult easy* easyworst case
blocking time large large small
systemoverload unstable stable stable
*for higher priority tasks
資工系網媒所 NEWS實驗室/5247
Priority Inversion
資工系網媒所 NEWS實驗室/5248
Priority Inheritance
資工系網媒所 NEWS實驗室/5249
Priority Inheritance (cont.)
m lower priority task access k distinct semaphoresA job can be blocked at most min(m,k) critical sections
Might have deadlocksChain of blocking
J1 access S1, S2 held by J2, J3
資工系網媒所 NEWS實驗室/5250
Priority Ceiling Protocol
Inherit the Priority Ceiling of a semaphore Priority Ceiling of a semaphore S
The highest priority of the jobs may lock S.Zi,j,k is the kth critical section in Ji guarded by Sj
Idea came from:When J1 preempts Z2,1, the priority of J1 will be strictly higher than the priorities of all the preempted critical sections, otherwise J1 is blocked and J2 inherits J1’s priority.
A job can be blocked for at most one duration of one critical section." i, 1 i n, C1/T1+C2/T2+…+Ci/Ti+Bi/Ti i(21/i-1)
資工系網媒所 NEWS實驗室/5251
Example 2
J1
J0
J20 1 2 3 4 5 6 7 8 9 1011121314 15
資工系網媒所 NEWS實驗室/5252
Multiprocessor PCP
Static binding vs. dynamic binding
Global semaphore vs. local semaphoreGlobal critical section vs. local semaphoreRemote blocking
11
12 ,)1(m
資工系網媒所 NEWS實驗室/5253
資工系網媒所 NEWS實驗室/5254