54
資資資資資資 NEWS 資資資 Paper Discussion C. L. Liu and James W. Layland , "Scheduling Algorithms for M u ltiprogramming in a Hard-Real-Time E nvironment", 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 /52 1

資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

Embed Size (px)

Citation preview

Page 1: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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

Page 2: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/522

Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment

No non-time-critical jobs

Pure 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

Page 3: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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.

Page 4: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/524

Real-Time Task Model

Periodic Task Model

parameters are known a priori

worst-case execution time

period

request time ready time deadline start finish preempt resume

Predictability vs. Schedulability

high predictability and schedulability

easy-to-check schedulability condition

Page 5: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/525

Time-Driven Scheduling Approachwidely used

inflexible, efficient

large space needede.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

Page 6: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/526

Terms in Scheduling

job: an instance of a task

deadline: next request time of the same task

overflow at time t: t is a deadline of unfulfilled request

feasible: scheduled with no overflow (schedulable)

response time: time span from request to finish

critical instance: an instance when a request will have the largest response time

critical time zone: time interval from a critical instance to its finish time

Page 7: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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.

Page 8: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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.

Page 9: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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.

Page 10: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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

Page 11: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5211

A Fixed Priority Scheduling Algorithm (cont.)

The minimum U occurs at the boundary of two cases

T1

T2

T1

T2

Page 12: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5212

Least Upper Bound

An easy-to-check schedulability condition

1

)12( /1 mm

n=2, 0.83

n=3, 0.78

n=, 0.69

)/(1

i

m

ii TCU

Page 13: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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 conditionderive bound

relax assumption

Page 14: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5214

T1

T2

T1

T2

T1

T2

T1

T2

Page 15: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5215

Page 16: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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%?

Page 17: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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.

Page 18: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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 feasible

case 10 T T1 T2…Tm

all bi beyond T

Page 19: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5219

Sufficient Condition (cont.)

case 2some bi were carried out before T

Page 20: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5220

A mixed Scheduling Algorithm?

Page 21: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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

Page 22: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5222

Pinwheel Problem

Given a multiset A={a1, a2, ... ,an}, ai Î N

Find an infinite sequence of symbols from {1, 2, ... , n} such that at least one symbol i within any interval of ai symbols

A={2,3} ® 1 2 1 2 1 2 ...® 1 1 2 1 1 2 ...

A unit-time schedule

Page 23: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5223

Pinwheel schedule 0 1 2 3 4 5 6 7 8 9 10 11 12

01

4

56

7

8

9

10

11

3

2

12

T1 (1,6)

T2 (3,6)

T4 (2,12)

T3 (2,12)

6

T2

T4T1

T1

T3

T2

6 6 6 6 6 6

Pinwheel Schedule

Page 24: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5224

Pinwheel Transformation

Pinwheel

any numbers ® multiples

jitterless, predictable

Signalanalog ® digital

noiseless, ease of control

e.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)

Page 25: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5225

Pinwheel Scheduling Properties

Good jitter control in schedules

Easy-to-check schedulability

Predictable resource accesses

Easy extension for aperiodic tasks

Predictable end-to-end delay

Network scheduling (INFOCOM’95 by Han & Shin)

Flexible time-driven approach

Page 26: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5226

Pinwheel Scheduler

Given a multi-set of distance constraints of n tasks

A={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

Page 27: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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 < 2b

dSbc 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

Page 28: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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 g

Srb: try all bases (optimal for single-number reduction)

HSr: near-optimal polynomial-time heuristic

Integer Pinwheel Scheduling: Sxg, Sxb , HSx

Page 29: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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

Page 30: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5230

Multiple-Node Scheduling

All nodes are specialized with the same base using DSr (Distributed Sr Scheduling)

Pinwheel phase alignment

Minimize the total end-to-end delay

Minimize the maximum end-to-end delay

Pinwheelj Pinwheel1 Pinwheel2 Pinwheelm ...

Nodej N1 N2 Nm ...

...

Page 31: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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 CSxb

a.

b.

e.

d.c.

f.

Page 32: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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 ...

...

Page 33: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5233

Page 34: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5234

Page 35: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5235

Simplification

Page 36: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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.

Page 37: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5237

Time-driven Scheduling Approach

Off-lineconstruct complete schedule

exponential time and space

generate effective time parametersstart time, resume time, finish time

optimization

On-lineexecute tasks according to off-line generated schedule or parameters, inflexible

0 3 6

Page 38: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5238

SSr: Pinwheel Schedule Constructor

Generate start times and finish times in O(n2)

task5

5.30 10.6 15.9

task1

21.2

task2

task3

task4

Page 39: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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 SSr

Next resume time can be found in O(n) the latest finish time of the preempting tasks

task1

task2

task3

task4

Page 40: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5240

TOPS:Time-driven On-line Pinwheel Scheduler

schedulerTOPS-c

(constant)TOPS-l(linear)

TOPS-f(flexible)

TOPS-m(mix)

off-linegenerates

S*,F*,R* S,FS,F,

priorityon-line

generatesR 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

Page 41: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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

Page 42: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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

Page 43: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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 CSxb

a.

b.

e.

d.c.

f.g.

Page 44: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室44

Examples of Schedulers

CRM

CSrb

CSx

CSr CSxba.

b. d.c.

a = {(1,2),(1,3)}, 0.83r @

[Sx] = {(1,2),(1,2)}, = 1Fb = {(1,2.1),(2.1,6)}, 0.83r @

[Sx] = {(1,2),(2.1,4)}, 1.03F @[Sr] = {(1,2.1),(2.1,4.2)}, F @

0.98[Sxb] = {(1,2),(2.1,6)} , = 0.85F

c = {(1,1.9),(1,4)}, 0.78r @

[Sr] = {(1,1.9),(1,3.8)} , 0.79F @[Sxb] = {(1,1),(1,4)} , = 1.25F

d = {(1,2),(2.1,6)}, = 0.85r

[Sr] = {(1,1.5),(2.1,6)}, F @ 1.02[Sxb] = {(1,2),(2.1,6)}, = 0.85F

Page 45: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5245

More Examples of Schedulers

e = {(1,1.9),(2.1,6)}, 0.88r @[Sr] ={(1,1.5),(2.1,6)}, 1.02F @

[Sxb] ={(1,1),(2.1,6)}, = 1.35F

[Srb] ={(1,1.9),(2.1,5.7)}, 0.89F @

f = {(1,2),(1,3),(1,7)}, r @0.97[Srb] = {(1,2),(1,2),

(1,6)}, 1.17F @

g = {(1,2),(1.1,3)}, 0.87r @

CRM

CSrb

CSx

CSrCSxb

e.

f.g.

Page 46: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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* easy

worst caseblocking time

large large small

systemoverload

unstable stable stable

*for higher priority tasks

Page 47: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5247

Priority Inversion

Page 48: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5248

Priority Inheritance

Page 49: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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 deadlocks

Chain of blockingJ1 access S1, S2 held by J2, J3

Page 50: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 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)

Page 51: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5251

Example 2

J1

J0

J20 1 2 3 4 5 6 7 8 9 1011121314 15

Page 52: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5252

Multiprocessor PCP

Static binding vs. dynamic binding

Global semaphore vs. local semaphore

Global critical section vs. local semaphore

Remote blocking

11

12 ,)1(m

Page 53: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5253

Page 54: 資工系網媒所 NEWS 實驗室 Paper Discussion C. L. Liu and James W. Layland, "Scheduling Algorithms for Multiprogramming in a Hard-Real- Time Environment", JACM, Vol

資工系網媒所 NEWS實驗室/5254