Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


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

1 資工系網媒所 NEWS 實驗室 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 /52 1

2 資工系網媒所 NEWS 實驗室 Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment No non-time-critical jobs Pure Process Control /52 2 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

3 資工系網媒所 NEWS 實驗室 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. /52 3

4 資工系網媒所 NEWS 實驗室 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 /52 4

5 資工系網媒所 NEWS 實驗室 Time-Driven Scheduling Approach widely used inflexible, efficient large space needed e.g. cyclic executive Priority-Driven Scheduling Approach dynamic-priority e.g. earliest deadline first fixed-priority e.g. rate monotonic Scheduling Approaches /52 5

6 資工系網媒所 NEWS 實驗室 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 /52 6

7 資工系網媒所 NEWS 實驗室 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. /52 7

8 資工系網媒所 NEWS 實驗室 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. /52 8

9 資工系網媒所 NEWS 實驗室 Optimality THEOREM 2. If a feasible priority assignment exists for some task set, the rate-monotonic priority assignment is feasible for that task set. /52 9

10 資工系網媒所 NEWS 實驗室 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 T1T1 T2T2 T1T1 T2T2 /52 10

11 資工系網媒所 NEWS 實驗室 A Fixed Priority Scheduling Algorithm (cont.) The minimum U occurs at the boundary of two cases T1T1 T2T2 T1T1 T2T2 /52 11

12 資工系網媒所 NEWS 實驗室 Least Upper Bound An easy-to-check schedulability condition 1 n=2, 0.83 n=3, 0.78 n= , 0.69 /52 12

13 資工系網媒所 NEWS 實驗室 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 bound relax assumption /52 13

14 資工系網媒所 NEWS 實驗室 /52 14 T1T1 T2T2 T1T1 T2T2 T1T1 T2T2 T1T1 T2T2

15 資工系網媒所 NEWS 實驗室 /52 15

16 資工系網媒所 NEWS 實驗室 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 schedule on-line off-line priority queue 100%? /52 16

17 資工系網媒所 NEWS 實驗室 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. /52 17

18 資工系網媒所 NEWS 實驗室 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 condition if U  1, and not feasible case 1 0  T  T 1 T 2 …T m all b i beyond T /52 18

19 資工系網媒所 NEWS 實驗室 Sufficient Condition (cont.) case 2 some b i were carried out before T /52 19

20 資工系網媒所 NEWS 實驗室 A mixed Scheduling Algorithm ? /52 20

21 資工系網媒所 NEWS 實驗室 /52 video server inter-frame distance must be less than 33ms robot arm movement needs steady and smooth operations satellite/cellular phone tracking service in constant time interval more predictable inter-execution time than the periodic task(PT) model worst inter-execution time for PT is 2xperiod-e i Distance-Constrained Task Model 21 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

22 資工系網媒所 NEWS 實驗室 Pinwheel Problem Given a multiset A={a 1, a 2,...,a n }, a i  Find an infinite sequence of symbols from {1, 2,..., n} such that at least one symbol i within any interval of a i symbols A={2,3}   A unit-time schedule /52 22

23 資工系網媒所 NEWS 實驗室 Pinwheel schedule 0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 4 5 6 7 8 9 10 11 3 2 12 T 1 (1,6) T 2 (3,6) T 4 (2,12) T 3 (2,12) 6 T2T2 T4T4 T1T1 T1T1 T3T3 T2T2 666666 Pinwheel Schedule /52 23

24 資工系網媒所 NEWS 實驗室 Pinwheel Transformation Pinwheel any numbers  multiples jitterless, predictable Signal analog  digital noiseless, ease of control e.g. CD music 2 E.g. A={3,4,6,13}    ={3,3,6,12} ={3,3,3  2 1, 3  2 2 } single-number reduction 3069 A B 12 (RM) (PW) /52 24

25 資工系網媒所 NEWS 實驗室 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 /52 25

26 資工系網媒所 NEWS 實驗室 Pinwheel Scheduler Given a multi-set of distance constraints of n tasks A={a 1, a 2,...,a n }, density  i (1/a i ) Find another B={b 1, b 2,...,b n },  i, b i  a i, A is schedulable if B is schedulable. If b i ’ s are multiples (b i |b j ) and  1, B is schedulable. E.g. A={3,4,6,7}  (specialized)  ={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 /52 26

27 資工系網媒所 NEWS 實驗室 Previous Works Sa:x=a 1, d Sa  Sx: a 1 /2  x  a 1, d Sx  S23:use 2 and 3, d S23  Sbc: b=a 1, b  c < 2b d Sbc  C X : the set of all instances schedulable by Scheduler x C S23 C Sx C Sa C Sbc d X : the schedulable density bound for Scheduler x 27

28 資工系網媒所 NEWS 實驗室 Single-node Pinwheel Scheduling Earlier work: use a base of 2, find x in (a 1 /2  a 1 ] 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 (a 1 /2  a 1 ] real-number distance constraints and execution times Our contributions: Sr g : use a base of g Sr b : try all bases (optimal for single-number reduction) HSr: near-optimal polynomial-time heuristic Integer Pinwheel Scheduling: Sx g, Sx b, HSx /52 28

29 資工系網媒所 NEWS 實驗室 Various Pinwheel Schedulers /52 29

30 資工系網媒所 NEWS 實驗室 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 Pinwheel j Pinwheel 1 Pinwheel 2 Pinwheel m... Node j N 1 N 2 N m... /52 30

31 資工系網媒所 NEWS 實驗室 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 C X : the set of all instances schedulable by Scheduler x C Sr b C Sx C Sr C Sx b a. b. e. d. c. f. /52 31

32 資工系網媒所 NEWS 實驗室 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. Node j N 1 N 2 N m... /52 32

33 資工系網媒所 NEWS 實驗室 /52 33

34 資工系網媒所 NEWS 實驗室 /52 34

35 資工系網媒所 NEWS 實驗室 Simplification /52 35

36 資工系網媒所 NEWS 實驗室 Study of Pinwheel Scheduling n tasks are schedulable on a node (using HSr) if the total utilization is  n (2 1/n - 1). n tasks are schedulable on all nodes (using DSr) if the utilization on any node is  2 1/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. /52 36

37 資工系網媒所 NEWS 實驗室 Time-driven Scheduling Approach Off-line construct complete schedule exponential time and space generate effective time parameters start time, resume time, finish time optimization On-line execute tasks according to off-line generated schedule or parameters, inflexible 0 3 6 /52 37

38 資工系網媒所 NEWS 實驗室 SSr: Pinwheel Schedule Constructor Generate start times and finish times in O(n 2 ) task 5 5.3010.615.9 task 1 21.2 task 2 task 3 task 4 /52 38

39 資工系網媒所 NEWS 實驗室 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 task 1 task 2 task 3 task 4 /52 39

40 資工系網媒所 NEWS 實驗室 TOPS :Time-driven On-line Pinwheel Scheduler * S:start time, F:finish time, R:resume time; * * amortized /52 40

41 資工系網媒所 NEWS 實驗室 Pinwheel Transformation Sr: d ={(1,2),(2.1,6)}  {(1,2),(2.1,4)} 2046 overflow Sx b : d ={(1,2),(2.1,6)}  {(1,2),(2.1,6)} 8 /52 41

42 資工系網媒所 NEWS 實驗室 /52 P X : the set of all periodic task sets schedulable by Scheduler x C X : 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)} P EDF P RM a.a. b. c. d. e. C Sr b P RM = C Sr b n  2 Relationship between C Sr b, P RM, and P EDF 42

43 資工系網媒所 NEWS 實驗室 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 Schedulers C X : the set of all instances schedulable by Scheduler x C RM C Sr b C Sx C Sr C Sx b a. b. e. d. c. f. g. /52 43

44 資工系網媒所 NEWS 實驗室 Examples of Schedulers C RM C Srb C Sx C Sr C Sxb a. b. d. c. a = {(1,2),(1,3)},  [Sx]  {(1,2),(1,2)},  b = {(1,2.1),(2.1,6)},  [Sx]  {(1,2),(2.1,4)},  [Sr]  {(1,2.1),(2.1,4.2)},  [Sxb]  {(1,2),(2.1,6)},  c = {(1,1.9),(1,4)},  [Sr]  {(1,1.9),(1,3.8)},  [Sxb]  {(1,1),(1,4)},  d = {(1,2),(2.1,6)},  [Sr]  {(1,1.5),(2.1,6)},    [Sxb]  {(1,2),(2.1,6)},  44

45 資工系網媒所 NEWS 實驗室 More Examples of Schedulers e = {(1,1.9),(2.1,6)},  [Sr]  {(1,1.5),(2.1,6)},  [Sxb]  {(1,1),(2.1,6)},  [Srb]  {(1,1.9),(2.1,5.7)},  f = {(1,2),(1,3),(1,7)},  [Srb]  {(1,2),(1,2),(1,6)},  g = {(1,2),(1.1,3)},  C RM C Srb C Sx C Sr C Sxb e. f. g. /52 45

46 資工系網媒所 NEWS 實驗室 Comparison of Schedulers *for higher priority tasks /52 46

47 資工系網媒所 NEWS 實驗室 Priority Inversion /52 47

48 資工系網媒所 NEWS 實驗室 Priority Inheritance /52 48

49 資工系網媒所 NEWS 實驗室 Priority Inheritance (cont.) m lower priority task access k distinct semaphores A job can be blocked at most min(m,k) critical sections Might have deadlocks Chain of blocking J 1 access S 1, S 2 held by J 2, J 3 /52 49

50 資工系網媒所 NEWS 實驗室 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. Z i,j,k is the k th critical section in J i guarded by S j Idea came from: When J 1 preempts Z 2,1, the priority of J 1 will be strictly higher than the priorities of all the preempted critical sections, otherwise J 1 is blocked and J 2 inherits J 1 ’s priority. A job can be blocked for at most one duration of one critical section.  i, 1  i  n, C 1 /T 1 +C 2 /T 2 +…+C i /T i +B i /T i  i(2 1/i -1) /52 50

51 資工系網媒所 NEWS 實驗室 Example 2 J1J1 J0J0 J2J2 0 1 2 3 4 5 6 7 8 9 1011121314 15 /52 51

52 資工系網媒所 NEWS 實驗室 /52 Multiprocessor PCP Static binding vs. dynamic binding Global semaphore vs. local semaphore Global critical section vs. local semaphore Remote blocking 52

53 資工系網媒所 NEWS 實驗室 /52 53

54 資工系網媒所 NEWS 實驗室 /52 54


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

Similar presentations


Ads by Google