Download presentation

Presentation is loading. Please wait.

Published byMarcia Pearson Modified about 1 year ago

1
5/12/2015COSC , Lecture 41 Real-Time Systems, COSC , Lecture 4 Stefan Andrei

2
5/12/2015 COSC , Lecture 4 2 Reminder of the last lecture Sporadic tasks Scheduling nonpreemptable tasks Scheduling nonpreemptable sporadic tasks Scheduling nonpreemptable tasks with precedence constraints Communicating periodic tasks: deterministic rendezvous model

3
5/12/2015 COSC , Lecture 4 3 Overview of This Lecture Multiprocessor scheduling Available scheduling tools Available real-time operating systems

4
5/12/2015 COSC , Lecture 4 4 Multiprocessor scheduling Generalizing the scheduling problem from a uniprocessor to a multiprocessor system increases the problem complexity since we now have to tackle the problem of assigning tasks to specific processors. In fact, for two or more processors, no scheduling algorithm can be optimal without a priori knowledge of the: 1. Deadlines 2. Computation times 3. Start times of the tasks.

5
5/12/2015 COSC , Lecture 4 5 Scheduling single-instance tasks Given n identical processors and m tasks at time i, m > n, our objective is to ensure that all tasks complete their execution by their respective deadlines. If m ≤ n (i.e., the number of tasks does not exceed the number of processors), the problem is trivial since each task has its own processor.

6
5/12/2015 COSC , Lecture 4 6 Schedule representation Static schedule representations: Gantt charts Timing diagrams Dynamic schedule representations: Scheduling game boards [Dertouzos, Mok; 1989] Example of two-processor system (n=2) for three single-instance tasks: J 1 : S 1 = 0, c 1 = 1, D 1 = 2 J 2 : S 2 = 0, c 2 = 2, D 2 = 3 J 3 : S 3 = 0, c 3 = 4, D 3 = 4

7
5/12/2015 COSC , Lecture 4 7 A Gantt chart for Example of slide 5 The below figure shows the Gantt chart of a feasible schedule for this task set. Figure 3.23 from [Cheng; 2005], page 66

8
5/12/2015 COSC , Lecture 4 8 A timing diagram for Example of slide 5 The below figure shows the timing diagram of a feasible schedule for this task set: Figure 3.24 from [Cheng; 2005], page 67

9
5/12/2015 COSC , Lecture 4 9 A game board for Example of slide 5 The below figure shows the scheduling game board representation of this task set at time i=0. The x-axis shows the laxity of a task and the y- axis shows its remaining computation time. Figure 3.25 from [Cheng; 2005], page 66

10
5/12/2015 COSC , Lecture 4 10 Scheduling single-instance tasks with game board Let C(i) denote the remaining computation time of a task at time i, and let L(i) denote the laxity (slack) of a task at time i (i.e., L(i)=D(i)-C(i)-S(i)). On the L-C plane of the scheduling board, executing any n of the m tasks in parallel corresponds to moving at most n of the m tokens one division (time unit) downward and parallel to the C-axis. Thus, for tasks executed: L(i+1) = L(i), C(i+1)=C(i)-1 Tokens corresponding to the remaining tasks that are not executed move to the left toward the C-axis. Thus, for tasks not executed: L(i+1) = L(i)-1, C(i+1)=C(i)

11
5/12/2015 COSC , Lecture 4 11 Rules for the Scheduling Game Board Each configuration of tokens on the L-C plane represents the scheduling problem at a point in time. The rules for the scheduling game are: Initially, the starting L-C plane configuration with tokens representing the tasks to be scheduled is given. At each step of the game, the scheduler can move at most n tokens one division downward toward the horizontal axis. The rest of the tokens move leftward toward the vertical axis. Any token reaching the horizontal axis can be ignored (it has completed its execution). The scheduler fails if any token crosses the vertical axis into the second quadrant before reaching the horizontal axis. The scheduler wins if no failure occurs.

12
5/12/2015 COSC , Lecture 4 12 EDF scheduler fails (ex. From slide 5) Example of two-processor system (n=2) for three single-instance tasks: J 1 : S 1 = 0, c 1 = 1, D 1 = 2 J 2 : S 2 = 0, c 2 = 2, D 2 = 3 J 3 : S 3 = 0, c 3 = 4, D 3 = 4 J 1 and J 2 have earlier absolute deadline, so they are assigned to start. Figure 3.26 from [Cheng; 2005], page 68

13
5/12/2015 COSC , Lecture 4 13 LL scheduler wins (ex. From slide 5) At time 0, J 3 has the lowest laxity, so it is assigned to start. The other one can be J 1 (since it has same laxity as J 2 ). Figure 3.27 from [Cheng; 2005], page 69

14
5/12/2015 COSC , Lecture 4 14 Conflict-Free Task Sets For two or more processors, no deadline scheduling algorithm can be optimal without a priori knowledge of the deadlines, computations times, and start times of the tasks. If no such a priori knowledge is available, optimal scheduling is possible if the set of tasks does not have subsets of conflict with each another [Dertouzos, Mok; 1989]. A special case is that in which all tasks have unit computation times (then EDF algorithm is optimal even for the multiprocessor case).

15
5/12/2015 COSC , Lecture 4 15 Conflict-Free Task Sets We divide the scheduling game board in 3 regions: R 1 (k)={J j : D j ≤ k} R 2 (k)={J j : L j ≤ k and D j > k} R 3 (k)={J j : L j > k} where k is the number time units. Surplus computing power function: F(k,i)=kn-Σ R1 C j -Σ R2 (k-L j ), for every positive integer k.

16
5/12/2015 COSC , Lecture 4 16 A Necessary Condition for Conflict- Free Task Sets F(k,i) provides a measure of the surplus computing power of the multiprocessor system in terms of available processor time units between a given time instant i and k time units into the future. A necessary condition for scheduling to meet the deadlines of a set of tasks whose start times are the same (at time i=0) is: For all k>0, F(k,0) ≥ 0.

17
5/12/2015 COSC , Lecture 4 17 A Sufficient Condition for Conflict- Free Task Sets Schedulability test 9: For a multiprocessor system, if a schedule exists that meets the deadlines of a set of single- instance tasks whose start times are the same, then the same set of tasks can be scheduled at run-time even if their start times are different and not known a priori. Knowledge of pre-assigned deadlines and computation times alone is enough to schedule using LL-algorithm.

18
Scheduling single-instance tasks. Example Let us consider the following preemptable single-instance task set: J 1 : S 1 = 0, c 1 = 1, D 1 = 2 J 2 : S 2 = 0, c 2 = 2, D 2 = 4 J 3 : S 3 = 0, c 3 = 4, D 3 = 5 1. how many processors do the above tasks set need to execute? 2. check the applicability of EDF-scheduling method. 3. draw a game board and check the applicability LL-scheduling method. 4. check the applicability of schedulability test 9. 5/12/2015 COSC , Lecture 4 18

19
Scheduling single-instance tasks. Example One processor does not suffice as at least one job will miss its deadline. Hence, there is a need of 2 processors to execute the given task set. 5/12/2015 COSC , Lecture 4 19

20
Scheduling game board. EDF strategy. Initial state 5/12/2015 COSC , Lecture 4 20

21
Scheduling game board. Time t=1(EDF) By EDF algorithm, J 1 and J 2 execute first since their absolute deadlines are earlier than J 3. 5/12/2015 COSC , Lecture 4 21

22
Scheduling game board. Time t=2(EDF) Since J 2 reaches horizontal axis, it is completed. 5/12/2015 COSC , Lecture 4 22

23
Scheduling game board. Time t=5(EDF) J 2 completes its execution at time t=5. 5/12/2015 COSC , Lecture 4 23

24
Scheduling game board. LL strategy. To check whether LL strategy works, we consider the scheduling board at the initial state (slide 20). At time t=0, both J 1 and J 3 have laxity 1. Hence J 1 and J 3 move downward (vertically) and J 2 moves to the left (horizontally). 5/12/2015 COSC , Lecture 4 24

25
Scheduling game board. Time t=1 (LL) 5/12/2015 COSC , Lecture 4 25 At time t=1, J 1 completes execution so the remaining tasks are J 2 and J 3.

26
Scheduling game board. Time t=2 (LL) 5/12/2015 COSC , Lecture 4 26 At time t=2, J 2 and J 3 again move downward.

27
Scheduling game board. Time t=3 (LL) 5/12/2015 COSC , Lecture 4 27

28
Scheduling game board. Time t=4 (LL) 5/12/2015 COSC , Lecture 4 28

29
Schedulability test 9 applied to our example Since there is an LL schedule for the above task set, it means the task set can be scheduled at run-time even if their start times are different and not known a priori (using the LL-algorithm). 5/12/2015 COSC , Lecture 4 29

30
5/12/2015 COSC , Lecture 4 30 Scheduling Periodic Tasks LL scheduler is optimal for a set of single- instance tasks satisfying a sufficient condition. This makes it possible to schedule tasks without knowing their release times in advance. This LL scheduler is no longer optimal for periodic tasks.

31
5/12/2015 COSC , Lecture 4 31 A Sufficient Condition for Scheduling Periodic Tasks Schedulability test 10: Given a set of k independent, preemptable (at discrete time instants), and periodic tasks on a multiprocessor system with n processors with U=c 1 /p 1 +…+c k /p k ≤n, let T=GCD(p 1, …, p k ), and t=GCD(T,T(c 1 /p 1 ), …, T(c k /p k )). A sufficient condition for feasible scheduling of this task set is t is integral.

32
5/12/2015 COSC , Lecture 4 32 Scheduling Periodic Tasks. Example 1 Consider two processors (n=2) and four tasks (period = deadline): J 1 : c 1 =32, p 1 =40 J 2 : c 2 =3, p 2 =10 J 3 : c 3 =4, p 3 =20 J 4 : c 4 =7, p 4 =10. U=32/40+3/10+4/20+7/10=2 ≤ n T=GCD(40, 10, 20, 10) = 10 t=GCD(10, 10(32/40), 10(3/10), 10(4/20), 10(7/10)) = GCD(10, 8, 3, 2, 7)=1. Since 1 is integral, a feasible schedule exists for this tasks set (according to Schedulability test 10).

33
5/12/2015 COSC , Lecture 4 33 A Feasible Schedule for Example 1 The tasks are assigned to processor 1 and “fill it up” until we encounter a task that cannot be scheduled on this processor. Figure 3.28 from [Cheng; 2005], page 71

34
Scheduling Periodic Tasks. Example 2 Let us consider the following preemptable, periodic, and independent task set: J 1 : c 1 =40, p 1 =50 J 2 : c 2 =4, p 2 =10 J 3 : c 3 =5, p 3 =25 J 4 : c 4 =6, p 4 = compute the utilization rate. 2. check the applicability of schedulability test find a feasible schedule for the above task set. 4. if the above tasks are non-preemptable, is there any feasible schedule for it? 5/12/2015 COSC , Lecture 4 34

35
Scheduling Periodic Tasks. Example 2 U = 2, hence two processors are needed to schedule the above task set. T = GCD(50, 10, 25, 10) = 5 t = GCD(T, T(c 1 /p 1 ), T(c 2 /p 2 ), T(c 3 /p 3 ), T(c 4 /p 4 )) = GCD(5, 5*40/50, 5*4/10, 5*5/25, 5*6/10) = 1. Since the value of t is integral, a feasible schedule exists for this task. 5/12/2015 COSC , Lecture 4 35

36
Scheduling Periodic Tasks. Example 2 5/12/2015 COSC , Lecture 4 36 Scheduling for preemptable task set using two processors and RM Scheduling algorithm:

37
Scheduling Periodic Tasks. Example 2 5/12/2015 COSC , Lecture 4 37 Scheduling for non-preemptable task set using two processors:

38
5/12/2015 COSC , Lecture 4 38 Available scheduling tools A variety of tools are available for scheduling and schedulability analysis of real-time tasks. Three of these are: PERTS (also called RAPID RMA) is downloadable from PerfoRMAx is downloadable from TimeWiz is downloadable from (n.t., obsolete)

39
5/12/2015 COSC , Lecture 4 39 Available real-time operating systems The goals of conventional, non-real-time operating systems are to provide a convenient interface between the user and the computer hardware while attempting to maximize average throughput, to minimize average time for tasks, and to ensure the fair and correct sharing of resources. However, meeting task deadlines is not an essential objective in non-real-time operating systems since its scheduler usually does not consider the deadlines of individual tasks when making scheduling decisions.

40
5/12/2015 COSC , Lecture 4 40 Available real-time operating systems For real-time applications in which task deadlines must be satisfied, a real-time operating system (RTOS) with an appropriate scheduler for scheduling tasks with timing constraints must be used. Since the late 1980s, several experiments as well as commercial RTOSs have been developed, most of which are extensions and modifications of existing operating systems such as UNIX. Most current RTOSs conform to the IEEE POSIX standard and its real-time extensions.

41
5/12/2015 COSC , Lecture 4 41 Commercial real-time operating systems LynxOS (http://www.lynx.com/) is Lynux’s hard RTOS based on the LINUX. It is scalable, Linux-compatible, and highly deterministic.http://www.lynx.com/ RTMX O/S (http://www.rtmx.com/) has support for X11 and motif on M68K, MIPS, SPARC and PowerPC processors.http://www.rtmx.com/ VxWorks and pSOSystem (http://www.winddriver.com/products/html/os.ht ml) are Wind River’s RTOS’s with a flexible, scalable, and reliable architecture for most CPU platforms.http://www.winddriver.com/products/html/os.ht ml

42
5/12/2015 COSC , Lecture 4 42 Summary Multiprocessor scheduling Available scheduling tools Available real-time operating systems

43
5/12/2015 COSC , Lecture 4 43 Reading suggestions From [Cheng; 2002] Chapter 3, sections 3.3, 3.4, 3.5 Chapters 3, 10 and 11 of [Kopetz; 1997] Chapter 2 of [Stankovic, Spuri, Ramamritham, Buttazzo; 1998]

44
5/12/2015 COSC , Lecture 4 44 Coming up next SAT-based Scheduling

45
5/12/2015 COSC , Lecture 4 45 Thank you for your attention! Questions?

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google