Download presentation
Presentation is loading. Please wait.
Published byCynthia Kelley Modified over 8 years ago
1
Static scheduling in HRT-systems Adam.Czajka@cs.put.poznan.pl Real-Time Systems Lecture 7 Copyright, 2001 © Adam Czajka
2
Contents Introduction Binarization algorithm Binarization costs Perioding loading problem Flexible loading problem Conclusions
3
Copyright, 2001 © Adam Czajka Ti3Ti3Ti3Ti3 Ti2Ti2Ti2Ti2 Ti1Ti1Ti1Ti1 Scheduling periodic tasks 1 x n xn xn xn xTask Ta Task 2 sk Task i iiii iiii iiii iiii HRT HOOD, protected objects
4
Copyright, 2001 © Adam Czajka Ti1Ti1Ti1Ti1 1 x n x Task Ta Task 2 sk Task i eieieiei iiii Valid schedule is built off-line and stored in a time-table array Valid schedule is built off-line and stored in a time-table array Static scheduling Simple task dispatcher is run on-line. The information from the time-table array is used to assign a processor to the particular task. Simple task dispatcher is run on-line. The information from the time-table array is used to assign a processor to the particular task.
5
Copyright, 2001 © Adam Czajka Tasks:T 1 T 2 T 3 T 4 Periods:1737131271 LCM = Question: Can we replace tasks’ periods in such a way that the size of the array will be decreased ? Can we replace tasks’ periods in such a way that the size of the array will be decreased ?Question: 17 * 37 * 131 * 271 = 22 330 129 Static scheduling
6
Copyright, 2001 © Adam Czajka Binary periods Tasks:T 1 T 2 T 3 T 4 Periods:1737131271 Answer: YES Answer: YES Every task T i can be run with any period p i iff p i i
7
Copyright, 2001 © Adam Czajka Tasks:T 1 T 2 T 3 T 4 Periods:1637131271 Answer: YES Answer: YES Binary periods Every task T i can be run with any period p i iff p i i
8
Copyright, 2001 © Adam Czajka Tasks:T 1 T 2 T 3 T 4 Periods:1632131271 Answer: YES Answer: YES Binary periods Every task T i can be run with any period p i iff p i i
9
Copyright, 2001 © Adam Czajka Tasks:T 1 T 2 T 3 T 4 Periods:1632128271 Answer: YES Answer: YES Binary periods Every task T i can be run with any period p i iff p i i
10
Copyright, 2001 © Adam Czajka Tasks:T 1 T 2 T 3 T 4 Periods:1632128256 Answer: YES Answer: YES Binary periods Every task T i can be run with any period p i iff p i i
11
Copyright, 2001 © Adam Czajka Tasks:T 1 T 2 T 3 T 4 Periods:1632128256 LCM = 256 Answer: YES Answer: YES Binary periods Every task T i can be run with any period p i iff p i i
12
Copyright, 2001 © Adam Czajka Binarization algorithm (1) Input: Input: sequence of periods = ( 1, 2,..., n ), where 1 = min{ i } sequence of periods = ( 1, 2,..., n ), where 1 = min{ i } Output: Output: Set of estimations, where each estimation has the form: [ p 0 : 2 k 1, 2 k 2,..., 2 k n ] p 1 = 2 k 1 p 0, p 2 = 2 k 2 p 0,... Set of estimations, where each estimation has the form: [ p 0 : 2 k 1, 2 k 2,..., 2 k n ] p 1 = 2 k 1 p 0, p 2 = 2 k 2 p 0,... Input: Input: sequence of periods = ( 1, 2,..., n ), where 1 = min{ i } sequence of periods = ( 1, 2,..., n ), where 1 = min{ i } Output: Output: Set of estimations, where each estimation has the form: [ p 0 : 2 k 1, 2 k 2,..., 2 k n ] p 1 = 2 k 1 p 0, p 2 = 2 k 2 p 0,... Set of estimations, where each estimation has the form: [ p 0 : 2 k 1, 2 k 2,..., 2 k n ] p 1 = 2 k 1 p 0, p 2 = 2 k 2 p 0,...
13
Copyright, 2001 © Adam Czajka Binarization algorithm (2) Step 1: Step 1: min = 1 /2; max = 1 ; E = ; min = 1 /2; max = 1 ; E = ; Step 2: Step 2: For every element i do the following: For every element i do the following: find k N, such that min < i /2 k max, let p 0 = i /2 k. find k N, such that min < i /2 k max, let p 0 = i /2 k. add estimation [p 0 : e( 1, p 0 ), e( 2, p 0 )..., e( n, p 0 )] to the set E, where e(a, b)=max{2 q : b2 q a} i 2 q N add estimation [p 0 : e( 1, p 0 ), e( 2, p 0 )..., e( n, p 0 )] to the set E, where e(a, b)=max{2 q : b2 q a} i 2 q N Step 1: Step 1: min = 1 /2; max = 1 ; E = ; min = 1 /2; max = 1 ; E = ; Step 2: Step 2: For every element i do the following: For every element i do the following: find k N, such that min < i /2 k max, let p 0 = i /2 k. find k N, such that min < i /2 k max, let p 0 = i /2 k. add estimation [p 0 : e( 1, p 0 ), e( 2, p 0 )..., e( n, p 0 )] to the set E, where e(a, b)=max{2 q : b2 q a} i 2 q N add estimation [p 0 : e( 1, p 0 ), e( 2, p 0 )..., e( n, p 0 )] to the set E, where e(a, b)=max{2 q : b2 q a} i 2 q N
14
Copyright, 2001 © Adam Czajka Binary periods Example:Example: = (17, 37, 131, 271); max = 17; p 1 = 17; min = 8.5; 2 k p 0 e(17, p 0 ) e(37, p 0 ) e(131, p 0 ) e(271, p 0 ) 1 17.00 1 2 4 8 4 9.25 1 4 8 16 8 16.75 1 2 8 16 16 16.12 1 2 4 16
15
Copyright, 2001 © Adam Czajka Binary periods Example:Example: = (17, 37, 131, 271); max = 17; p 1 = 17; min = 8.5; 2 k p 0 e(17, p 0 ) e(37, p 0 ) e(131, p 0 ) e(271, p 0 ) 1 17.00 1 2 4 8 4 9.25 1 4 8 16 8 16.75 1 2 8 16 16 16.12 1 2 4 16 Basic binarization
16
Copyright, 2001 © Adam Czajka Binary periods Question:Question: Which estimation is the best one ? We say, that estimation B = [p 0 : 2 k 1, 2 k 2,..., 2 k n ] dominates over the estiamtion B’ = [p 0 ’ : 2 k 1 ’, 2 k 2 ’,..., 2 k n ’ ] iff the following two conditions are met: 1. schedule(B’) => schedule(B) & 1. schedule(B’) => schedule(B) & ~ ( schedule(B) => schedule(B’)) ~ ( schedule(B) => schedule(B’)) We say, that estimation B = [p 0 : 2 k 1, 2 k 2,..., 2 k n ] dominates over the estiamtion B’ = [p 0 ’ : 2 k 1 ’, 2 k 2 ’,..., 2 k n ’ ] iff the following two conditions are met: 1. schedule(B’) => schedule(B) & 1. schedule(B’) => schedule(B) & ~ ( schedule(B) => schedule(B’)) ~ ( schedule(B) => schedule(B’))
17
Copyright, 2001 © Adam Czajka Binary periods Question:Question: Which estimation is the best one ? We say, that estimation B = [p 0 : 2 k 1, 2 k 2,..., 2 k n ] dominates over the estiamtion B’ = [p 0 ’ : 2 k 1 ’, 2 k 2 ’,..., 2 k n ’ ] iff the following two conditions are met: 2. schedule(B’) => schedule(B) & 2. schedule(B’) => schedule(B) & schedule(B) => schedule(B’) & p 0 > p 0 ’ schedule(B) => schedule(B’) & p 0 > p 0 ’ We say, that estimation B = [p 0 : 2 k 1, 2 k 2,..., 2 k n ] dominates over the estiamtion B’ = [p 0 ’ : 2 k 1 ’, 2 k 2 ’,..., 2 k n ’ ] iff the following two conditions are met: 2. schedule(B’) => schedule(B) & 2. schedule(B’) => schedule(B) & schedule(B) => schedule(B’) & p 0 > p 0 ’ schedule(B) => schedule(B’) & p 0 > p 0 ’
18
Copyright, 2001 © Adam Czajka Binary periods Question:Question: Which estimation is the best one ? When for the estimation B = [p 0 : 2 k 1, 2 k 2,..., 2 k n ] we are unable to find such an estimation B’ which dominates B, we say that B is non-dominated estimation. When for the estimation B = [p 0 : 2 k 1, 2 k 2,..., 2 k n ] we are unable to find such an estimation B’ which dominates B, we say that B is non-dominated estimation.
19
Copyright, 2001 © Adam Czajka Binary periods Question:Question: Which estimation is the best one ? Theorem Binarization algorithm finds only the non- dominated estimations. Theorem
20
Copyright, 2001 © Adam Czajka Binary periods Question:Question: Which estimation is the best one ? Theorem If we cannot find a valid schedule for all non- dominated estimations, then the valid schedule doesn’t exist for any other binary estimation. Theorem
21
Copyright, 2001 © Adam Czajka Binary periods Question:Question: Which estimation is the best one ? Answer : We have to check ALL non-dominated estimations ! We have to check ALL non-dominated estimations ! None of them is the best one. None of them is the best one.
22
Copyright, 2001 © Adam Czajka Binarization costs Question:Question: What about tasks’ execution times ? There is a possibility, that: There is a possibility, that: the schedule exist before and doesn’t exist after the binarization process ! the schedule exist before and doesn’t exist after the binarization process ! There is a possibility, that: There is a possibility, that: the schedule exist before and doesn’t exist after the binarization process ! the schedule exist before and doesn’t exist after the binarization process !
23
Copyright, 2001 © Adam Czajka Binarization costs (1) T i = { T 1, T 2, T 3 } i = { 10, 20, 30 } i = { 5, 5, 5 } T i = { T 1, T 2, T 3 } p i = { 10, 20, 20 } i = { 5, 5, 5 } 0102030405060 01020
24
Copyright, 2001 © Adam Czajka Binarization costs (2) T i ={T 1, T 2, T 3, T 4 } i ={10, 20, 30, 60} i ={5, 5, 5, 5} 0102030405060 T i ={T 1, T 2, T 3, T 4 } p i ={10, 20, 20, 40} i ={5, 5, 5, 5} 010203040 ?
25
Copyright, 2001 © Adam Czajka Binarization costs Question:Question: How much we should speed-up the CPU to obtain the valid schedule ?
26
Copyright, 2001 © Adam Czajka Binarization costs Theorem If exists the valid schedule for tasks {T 1, T 2,..., T n }, then exist the valid schedule for tasks {T 1 ’, T 2 ’,..., T n ’}, where - the periods of the tasks {T 1 ’, T 2 ’,..., T n ’} are the basic binarization of the periods of tasks {T 1, T 2,..., T n } - i ’ = i / 2Theorem If exists the valid schedule for tasks {T 1, T 2,..., T n }, then exist the valid schedule for tasks {T 1 ’, T 2 ’,..., T n ’}, where - the periods of the tasks {T 1 ’, T 2 ’,..., T n ’} are the basic binarization of the periods of tasks {T 1, T 2,..., T n } - i ’ = i / 2
27
Copyright, 2001 © Adam Czajka Binarization costs T i ={T 1, T 2, T 3, T 4 } i ={10, 20, 30, 60} i ={5, 5, 5, 5} 0102030405060 T i ={T 1, T 2, T 3, T 4 } p i = {10, 20, 20, 40} i = {5, 5, 5, 5} 010203040
28
Copyright, 2001 © Adam Czajka Binarization costs T i ={T 1, T 2, T 3, T 4 } i ={10, 20, 30, 60} i ={5, 5, 5, 5} 0102030405060 T i ={T 1, T 2, T 3, T 4 } p i = {10, 20, 20, 40} i ’ = {2.5, 2.5, 2.5, 2.5} 0 10203040
29
Copyright, 2001 © Adam Czajka Binarization costs T i ={T 1, T 2, T 3, T 4 } i ={10, 20, 30, 60} i ={5, 5, 5, 5} 0102030405060 T i ={T 1, T 2, T 3, T 4 } p i = {10, 20, 20, 40} i ’ = {2.5, 2.5, 2.5, 2.5} 0 10203040
30
Copyright, 2001 © Adam Czajka Binarization costs
31
Copyright, 2001 © Adam Czajka Scheduling tasks with binary periods Applications MAFT architecture MAFT architecture Implementation of MIL-STD-1553 Implementation of MIL-STD-1553
32
Copyright, 2001 © Adam Czajka Periodic loading T13T13T13T13 T12T12T12T12 T11T11T11T11 = p 0 T14T14T14T14 Timeframe Period of a task T i : p i = w i p 0, where w i = 2 j T21T21T21T21 w 1 = 1 w 2 = 2
33
Copyright, 2001 © Adam Czajka T1T1T1T1 T1T1T1T1 T2T2T2T2 T1T1T1T1 T2T2T2T2 T1T1T1T1 T3T3T3T3 T1T1T1T1 T2T2T2T2 T1T1T1T1 T3T3T3T3 T1T1T1T1 T1T1T1T1 T2T2T2T2 F[0] F[1] F[2] F[3] w 1 = 1 w 2 = 2 w 3 = 4 Periodic loading
34
Copyright, 2001 © Adam Czajka T1T1T1T1 T2T2T2T2 T1T1T1T1 T3T3T3T3 T1T1T1T1 T1T1T1T1 T2T2T2T2 F[0] F[1] F[2] F[3] Phase f(i) of task T i : T i is executed every frame f i + k w i, k= 0,1, 2,.. f 1 = 0 f 2 = 0 f 3 = 1 Periodic loading w 1 = 1 w 2 = 2 w 3 = 4
35
Copyright, 2001 © Adam Czajka T1T1T1T1 T2T2T2T2 T1T1T1T1 T3T3T3T3 T1T1T1T1 T1T1T1T1 T2T2T2T2 F[0] F[1] F[2] F[3] i = duration of task T i y j = load of frame F[j] y 0 = 1 + 2 y 1 = 1 + 3 y 2 = 1 + 2 y 3 = 1 Periodic loading w 1 = 1 w 2 = 2 w 3 = 4 f 1 = 0 f 2 = 0 f 3 = 1
36
Copyright, 2001 © Adam Czajka T1T1T1T1 T2T2T2T2 T1T1T1T1 T3T3T3T3 T1T1T1T1 T1T1T1T1 T2T2T2T2 F[0] F[1] F[2] F[3] Maximal load z = max {y 0, y 1,.., y P-1 } P = the number of frames = LCM{ w 1,..., w n } z = y 1 Periodic loading y 0 = 1 + 2 y 1 = 1 + 3 y 2 = 1 + 2 y 3 = 1
37
Copyright, 2001 © Adam Czajka T1T1T1T1 T2T2T2T2 T1T1T1T1 T3T3T3T3 T1T1T1T1 T1T1T1T1 T2T2T2T2 F[0] F[1] F[2] F[3] z = y 1 Periodic loading Given a set of tasks {T 1,.., T i,.., T n }, their periods p i and duration times i find their phases f i such that minimise the maximum load z. y 0 = 1 + 2 y 1 = 1 + 3 y 2 = 1 + 2 y 3 = 1
38
Copyright, 2001 © Adam Czajka T1T1T1T1 T2T2T2T2 T1T1T1T1 T3T3T3T3 T1T1T1T1 T1T1T1T1 T2T2T2T2 F[0] F[1] F[2] F[3] z = y 1 For a given a set of tasks {T 1,.., T i,.., T n }, their periods p i and duration times i are there such phases f i that the maximum load z ? Periodic loading problem y 0 = 1 + 2 y 1 = 1 + 3 y 2 = 1 + 2 y 3 = 1
39
Copyright, 2001 © Adam Czajka Complexity The periodic loading problem is strongly NP-hard [Schweitzer et al., 1989] A heuristic strategy Non-decreasing periods Non-decreasing periods Non-decreasing duration Non-decreasing duration
40
Copyright, 2001 © Adam Czajka The NID heuristic [Schweitzer et al., 1989] Input: {T i }, { i }, {w i }; 1. P:= max{ w i }; empty the frames F[0],.., F[P-1]; 2. Sort the tasks according to non-increasing order of duration time i. 3. Assign T i to first such a frame F[j] (0 j < w i ) that its load y j is minimal, and then to every F[j+k w i ] frame, where k = 1, 2,..., (P/w i -1)
41
Copyright, 2001 © Adam Czajka The NDP heuristic [Schweitzer et al., 1989] Input: {T i }, { i }, {w i }; 1. P:= max{ w i }; empty the frames F[0],.., F[P-1]; 2. Sort the tasks according to non-decreasing order of periods w i. 3. Assign T i to first such a frame F[j] (0 j < w i ) that its load y j is minimal, and then to every F[j+k w i ] frame, where k = 1, 2,..., (P/w i -1)
42
Copyright, 2001 © Adam Czajka The NDP/D heuristic [Schweitzer et al., 1989] Input: {T i }, { i }, {w i }; 1. P:= max{ w i }; empty the frames F[0],.., F[P-1]; 2. Sort the tasks according to non-decreasing order of coefficients r i = w i / i. 3. Assign T i to first such a frame F[j] (0 j < w i ) that its load y j is minimal, and then to every F[j+k w i ] frame, where k = 1, 2,..., (P/w i -1)
43
Copyright, 2001 © Adam Czajka Experiments
44
Copyright, 2001 © Adam Czajka Flexible loading T13T13T13T13 T12T12T12T12 T11T11T11T11 = p 0 T14T14T14T14 Timeframe T21T21T21T21 w 1 =1 w 2 =2 w 3 =2 Period of a task T i : p i = w i p 0, where w i = 2 j
45
Copyright, 2001 © Adam Czajka Flexible loading T12T12T12T12 T11T11T11T11 = p 0 T14T14T14T14 Timeframe T21T21T21T21 T31T31T31T31 T13T13T13T13 w 1 =1 w 2 =2 w 3 =2 Period of a task T i : p i = w i p 0, where w i = 2 j
46
Copyright, 2001 © Adam Czajka Flexible loading T12T12T12T12 T11T11T11T11 T14T14T14T14 Timeframe T21T21T21T21 T31T31T31T31 T13T13T13T13 = p 0 w 1 =1 w 2 =2 w 3 =2 Period of a task T i : p i = w i p 0, where w i = 2 j
47
Copyright, 2001 © Adam Czajka Flexible loading T13T13T13T13 T12T12T12T12 T11T11T11T11 T14T14T14T14 Timeframe T21T21T21T21 T31T31T31T31 = p 0 w 1 =1 w 2 =2 w 3 =2 Period of a task T i : p i = w i p 0, where w i = 2 j
48
Copyright, 2001 © Adam Czajka Flexible loading T13T13T13T13 T12T12T12T12 T11T11T11T11 T14T14T14T14 Timeframe T21T21T21T21 T31T31T31T31 = p 0 w 1 =1 w 2 =2 w 3 =2 Period of a task T i : p i = w i p 0, where w i = 2 j
49
Copyright, 2001 © Adam Czajka Flexible loading T13T13T13T13 T12T12T12T12 T11T11T11T11 T14T14T14T14 Timeframe T21T21T21T21 T31T31T31T31 = p 0 w 1 =1 w 2 =2 w 3 =2 Period of a task T i : p i = w i p 0, where w i = 2 j
50
Copyright, 2001 © Adam Czajka Flexible loading problem Set of non-preemptable tasks {T i } Set of non-preemptable tasks {T i } Each task is characterized by period p i and execution time i Each task is characterized by period p i and execution time i For each task d i = p i For each task d i = p i There is no precedence constraints There is no precedence constraints Given : Given :
51
Copyright, 2001 © Adam Czajka Flexible loading problem Question : Question : Can every task T i be scheduled within its period p i, i.e. : Every instance of T i starts within its period Every instance of T i finishes before the next period of T i Tasks do not overlap
52
Copyright, 2001 © Adam Czajka Complexity The flexible loading problem is strongly NP-hard [Inform. Proc. Letters 65, 1998, 173-178] A heuristic strategy VG algorithm VG algorithm
53
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 3 4p 0 2 T 4 4p 0 5 p 0 = 4 = p 0
54
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 3 4p 0 2 T 4 4p 0 5 p 0 = 4 = p 0
55
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
56
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
57
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
58
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
59
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
60
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
61
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
62
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
63
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
64
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
65
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
66
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
67
Copyright, 2001 © Adam Czajka VG heuristic Task PeriodExec. Time T 1 p 0 1 T 1 p 0 1 T 2 2p 0 2 T 4 4p 0 5 T 3 4p 0 2 p 0 = 4 = p 0
68
Copyright, 2001 © Adam Czajka Conclusions Binarization allow us to radically decrease the size of the time-table array Problem of scheduling tasks with binary periods is strongly NP-hard There exists some efficient heuristics which can be used to build the feasible schedule
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.