Download presentation

Presentation is loading. Please wait.

1
**Real-Time Systems, COSC-4301-01, Lecture 4**

Stefan Andrei 4/15/2017 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 4/15/2017 COSC , Lecture 4

3
**Overview of This Lecture**

Multiprocessor scheduling Available scheduling tools Available real-time operating systems 4/15/2017 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: Deadlines Computation times Start times of the tasks. 4/15/2017 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. 4/15/2017 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: J1: S1 = 0, c1 = 1, D1 = 2 J2: S2 = 0, c2 = 2, D2 = 3 J3: S3 = 0, c3 = 4, D3 = 4 4/15/2017 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 4/15/2017 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 The rectangles should contain the processor’s number, that is, 1, 1, 2 or 2, 2, 1. 4/15/2017 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 4/15/2017 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) 4/15/2017 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. 4/15/2017 COSC , Lecture 4

12
**EDF scheduler fails (ex. From slide 5)**

Example of two-processor system (n=2) for three single-instance tasks: J1: S1 = 0, c1 = 1, D1 = 2 J2: S2 = 0, c2 = 2, D2 = 3 J3: S3 = 0, c3 = 4, D3 = 4 J1 and J2 have earlier absolute deadline, so they are assigned to start. Figure 3.26 from [Cheng; 2005], page 68 4/15/2017 COSC , Lecture 4

13
**LL scheduler wins (ex. From slide 5)**

At time 0, J3 has the lowest laxity, so it is assigned to start. The other one can be J1 (since it has same laxity as J2). Figure 3.27 from [Cheng; 2005], page 69 4/15/2017 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). 4/15/2017 COSC , Lecture 4

15
**Conflict-Free Task Sets**

We divide the scheduling game board in 3 regions: R1(k)={Jj: Dj ≤ k} R2(k)={Jj: Lj ≤ k and Dj > k} R3(k)={Jj: Lj > k} where k is the number time units. Surplus computing power function: F(k,i)=kn-ΣR1Cj-ΣR2(k-Lj), for every positive integer k. 4/15/2017 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. 4/15/2017 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. 4/15/2017 COSC , Lecture 4

18
**Scheduling single-instance tasks. Example**

Let us consider the following preemptable single-instance task set: J1: S1 = 0, c1 = 1, D1 = 2 J2: S2 = 0, c2 = 2, D2 = 4 J3: S3 = 0, c3 = 4, D3 = 5 how many processors do the above tasks set need to execute? check the applicability of EDF-scheduling method. draw a game board and check the applicability LL-scheduling method. check the applicability of schedulability test 9. Doublecheck whether the ceiling of USIT = \Sum c_i/D can be used as the number of minimum processors able to schedule the single instance task set, where D = max{D_1, …, D_m}. 4/15/2017 COSC , Lecture 4

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. 4/15/2017 COSC , Lecture 4

20
**Scheduling game board. EDF strategy. Initial state**

4/15/2017 COSC , Lecture 4

21
**Scheduling game board. Time t=1(EDF)**

By EDF algorithm, J1 and J2 execute first since their absolute deadlines are earlier than J3. 4/15/2017 COSC , Lecture 4

22
**Scheduling game board. Time t=2(EDF)**

Since J2 reaches horizontal axis, it is completed. 4/15/2017 COSC , Lecture 4

23
**Scheduling game board. Time t=5(EDF)**

J2 completes its execution at time t=5. 4/15/2017 COSC , Lecture 4

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 J1 and J3 have laxity 1. Hence J1 and J3 move downward (vertically) and J2 moves to the left (horizontally). 4/15/2017 COSC , Lecture 4

25
**Scheduling game board. Time t=1 (LL)**

At time t=1, J1 completes execution so the remaining tasks are J2 and J3. 4/15/2017 COSC , Lecture 4

26
**Scheduling game board. Time t=2 (LL)**

At time t=2, J2 and J3 again move downward. 4/15/2017 COSC , Lecture 4

27
**Scheduling game board. Time t=3 (LL)**

4/15/2017 COSC , Lecture 4

28
**Scheduling game board. Time t=4 (LL)**

4/15/2017 COSC , Lecture 4

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). 4/15/2017 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. 4/15/2017 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=c1/p1+…+ck/pk≤n, let T=GCD(p1, …, pk), and t=GCD(T,T(c1/p1), …, T(ck/pk)). A sufficient condition for feasible scheduling of this task set is t is integral. 4/15/2017 COSC , Lecture 4

32
**Scheduling Periodic Tasks. Example 1**

Consider two processors (n=2) and four tasks (period = deadline): J1: c1=32, p1=40 J2: c2=3, p2=10 J3: c3=4, p3=20 J4: c4=7, p4=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). 4/15/2017 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 4/15/2017 COSC , Lecture 4

34
**Scheduling Periodic Tasks. Example 2**

Let us consider the following preemptable, periodic, and independent task set: J1: c1=40, p1=50 J2: c2=4, p2=10 J3: c3=5, p3=25 J4: c4=6, p4=10. compute the utilization rate. check the applicability of schedulability test 10. find a feasible schedule for the above task set. if the above tasks are non-preemptable, is there any feasible schedule for it? 4/15/2017 COSC , Lecture 4

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(c1/p1), T(c2/p2), T(c3/p3), T(c4/p4)) = 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. 4/15/2017 COSC , Lecture 4

36
**Scheduling Periodic Tasks. Example 2**

Scheduling for preemptable task set using two processors and RM Scheduling algorithm: 4/15/2017 COSC , Lecture 4

37
**Scheduling Periodic Tasks. Example 2**

Scheduling for non-preemptable task set using two processors: 4/15/2017 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) 4/15/2017 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. 4/15/2017 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. 4/15/2017 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. RTMX O/S (http://www.rtmx.com/) has support for X11 and motif on M68K, MIPS, SPARC and PowerPC processors. VxWorks and pSOSystem (http://www.winddriver.com/products/html/os.html) are Wind River’s RTOS’s with a flexible, scalable, and reliable architecture for most CPU platforms. 4/15/2017 COSC , Lecture 4

42
**Summary Multiprocessor scheduling Available scheduling tools**

Available real-time operating systems Models and modelling (analysis & design models) A model is totality of information to describe the 5 views Methodologies = defines a number of models that can be used to develop a system = Examples (structured methods, OO methods) = Formal notations (OO model = UML) UML = unification of earlier OO modelling languages Design models and code (the models used in the design of a system present an abstract view of it, and an implementation adds enough detail to make these models executable). The software development process (Unified Process) 4/15/2017 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] 4/15/2017 COSC , Lecture 4

44
Coming up next SAT-based Scheduling 4/15/2017 COSC , Lecture 4

45
**Thank you for your attention! Questions?**

4/15/2017 COSC , Lecture 4

Similar presentations

OK

Chapter 3: Real-Time Scheduling and Schedulability Analysis Albert M. K. Cheng.

Chapter 3: Real-Time Scheduling and Schedulability Analysis Albert M. K. Cheng.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Business ppt on flipkart online Ppt on biodegradable and non biodegradable materials problems Ppt on water our life line screening Ppt on cse related topics to economics In ppt one time pad Ppt on 2nd world war american Ppt on regional trade agreements japan Ppt on library management system in java Ppt on self development articles Ppt on travels and tourism