Presentation is loading. Please wait.

Presentation is loading. Please wait.

Real Time Operating Systems Schedulability - Part 2 Course originally developed by Maj Ron Smith 12/20/2015Dr Alain Beaulieu1.

Similar presentations


Presentation on theme: "Real Time Operating Systems Schedulability - Part 2 Course originally developed by Maj Ron Smith 12/20/2015Dr Alain Beaulieu1."— Presentation transcript:

1 Real Time Operating Systems Schedulability - Part 2 Course originally developed by Maj Ron Smith 12/20/2015Dr Alain Beaulieu1

2 Outline  Review of RMA and Utilization Bound Testing  Revisiting Critical Instances  Time Demand Analysis  Schedulability & Aperiodic Tasks  Deadline Monotonic Priority Algorithm  Schedulability & Bandwidth Preserving Servers  Deferrable Server Schedulability 12/20/2015 Dr Alain Beaulieu

3 Utilization based schedulability tests  pros:  usually involves a “simple” computational test  mathematically rigorous  Seminal paper  cons:  not always conclusive  sufficient but not necessary  only valid if the workload model and the underlying assumptions of the test are consistent  can lead to false confidence 12/20/2015 Dr Alain Beaulieu

4 Alternatives  When utilization based tests are inconclusive, we can always construct a timing graph of the system  construct graph over the interval [0, max {p i }]  if all tasks meet their deadlines within their first period, the system is schedulable  assumes that all tasks are in phase  the problem with this approach is that it will be impractical for most large systems and is not easily automated  As experienced in the first homework  alternative: time-demand analysis 12/20/2015 Dr Alain Beaulieu

5 Revisiting Critical Instants  Recall that a critical instant is defined as the instant in time that a job is released such that it has the maximum response time of all jobs in the task  think of it as the worst possible time (busiest) to release on the processor  Theorem: in a fixed priority system ( where every job in a task completes before another job in the same task releases), the critical instant for T i occurs when it releases at the same time as a job in each higher priority task 12/20/2015 Dr Alain Beaulieu

6 Critical Instants  Example 1:  T= { (3,1), (5, 1), (10, 2) }  The critical instant for tasks T 2 and T 3 is 0 024612 T1T1 T2T2 T3T3 810 1 1 1 111 1 1 1 1 In fact for in phase tasks, a critical instant always exists at t = 0 12/20/2015 Dr Alain Beaulieu

7 Critical Instants  Example 2:  T= { (1,3,1,3), (5, 1), (10, 2) }  The critical instant for tasks T 2 and T 3 is 10 024612 T1T1 T2T2 T3T3 810 1 1 1 111 1 1 1 1 12/20/2015 Dr Alain Beaulieu

8 Time-Demand Analysis (D i ≤ p i )  Under time-demand analysis we:  predict the worst case response time for each task going from highest priority to lowest  then compare each task’s response time to its deadline  if all worst case response times are less than their respective deadlines, the system is schedulable  Recall that a tasks response time is its completion time minus its release time This technique is sometimes referred to as response time analysis 12/20/2015 Dr Alain Beaulieu

9 Worst-Case Response Time  Alternatively, the response time of a task is defined to be the sum of its own worst case computation time and its maximum interference -> w i = e i + I i (1) where I i is the maximum interference * that task i can experience in any time interval [t, w i ) *The condition for maximum interference obviously occurs when all higher priority tasks are released at the same time as task i (in other words, at a critical instant) 12/20/2015 Dr Alain Beaulieu

10 Counting Releases  Consider task i and a higher priority task j  now, the number of releases of task j in time interval 0 to w i can be derived as follows: # of releases j =  w i /p j  (2) ceiling function [ 0, w i ) 0 100 200 ijij 40 5 pipi pjpj # of releases = 2 wiwi 12/20/2015 Dr Alain Beaulieu

11 Determining Interference  From this, the maximum interference of task j on task i in interval 0 to w i is given by: max interference (task j) =  w i /p j  e j (3)  but there may be other higher priority tasks, therefore: I i =   w i /p j  e j (4) [ 0, w i ) j  hp(i) 12/20/2015 Dr Alain Beaulieu

12 Calculating Response Time  Substituting equation (4) into (1) gives the general expression for response time: w i = e i +   w i /p j  e j (5)  Note the following issue (problem):  w i is on both sides of this “strange” equation  Before we attempt to solve this equation, let’s first see if we can understand it j  hp(i) 12/20/2015 Dr Alain Beaulieu

13 Understanding Response Time T = { (100, 20), (150, 30), (250, 60) } w 3 = e 3 +  w 3 /p 1  e 1 +  w 3 /p 2  e 2 = 60 + 2(20) + 1(30) {by viewing the graph} = 130 0 100 200 T1T2T3T1T2T3 w 3 = 130 12/20/2015 Dr Alain Beaulieu

14 Solving the Response Time Equation  Essentially, form a recursive relationship with equation (5) and solve iteratively: w i n+1 = e i +   w i n / p j  e j (6) where initial (seed) value w i 0 = e i  The algorithm then becomes: solve for successive values of w i n+1 if w i n+1 = w i n, then solution found -> w i = w i n if w i n+1 > D i, then task i cannot meet its deadline j  hp(i) 12/20/2015 Dr Alain Beaulieu

15 Response Time Analysis Example Given T = { (7,3), (12, 3), (20,5) }  Use RMA scheduling  Apply the utilization based schedulabilty test  If necessary, use time-demand analysis to determine whether the system is schedulable 12/20/2015 Dr Alain Beaulieu

16 Schedulability & Asynchronous Tasks  The simple task model that we have been able to deal with thus far is restrictive in several ways. Not being able to handle asynchronous tasks is a major restriction.  One approach is to make asynchronous tasks resemble periodic tasks  consider that an asynchronous task’s minimum inter-arrival time can be treated like a period, T  with just this assumption one can use RMA to extend to both types of tasks, BUT 12/20/2015 Dr Alain Beaulieu

17 Deadline Monotonic Priority Ordering  The simple task model assumption that D=p is also unrealistic for most asynchronous tasks  often, an asynchronous task will occur infrequently (large inter-arrival time) but must be serviced quickly -> D < p  therefore priority assignment based upon p will usually not satisfy the requirement to meet D  The deadline monotonic priority ordering (DMPO) scheme is introduced as follows:  the shorter the task deadline, the higher the priority 12/20/2015 Dr Alain Beaulieu

18 DMPO Example Taske i p i D i  i w i * 1 320513 2315726 341010310 432020420  * Response times are calculated using the methods presented earlier using equation (6) Note that a rate monotonic ordering would not schedule these tasks 12/20/2015 Dr Alain Beaulieu

19 Schedulability & BP Servers  Recall that a bandwidth preserving server is a type of polling server that permits the budget of the server to be preserved until later in the period should an asynchronous job arrive  We described two general classes of bandwidth preserving server:  deferrable server  sporadic server How do we determine the schedulability of the system in the presence of bandwidth preserving servers? 12/20/2015 Dr Alain Beaulieu

20 Recall: Deferrable Servers  A deferrable server is a bandwidth preserving server with period p s and execution budget e s which  preserves its budget if idle, and  replenishes its budget fully every period  Budgets are not allowed to accumulate from period to period  Since the deferrable server is purely periodic, it can be assigned priority along with all other periodic tasks  … and, for reasons that will now be explained, we must ensure that the priority of the deferrable server is higher than all other periodic tasks 12/20/2015 Dr Alain Beaulieu

21 Recall the Deferrable Server Example  The schedule for this system is given below: T= {(2, 3.5, 1.5, 3.5), (6, 0.5) } T DS = (3,1) A 1 = (2.5, 2) 024 T1T1 T2T2 T DS 68 1/2 11 1 2.55.5 Note:  = {T DS, T 1, T 2 } 12/20/2015 Dr Alain Beaulieu

22 Critical Instants & Systems with Deferrable Servers  In order to use time demand analysis on a system with a deferrable server, a critical instant, t 0, must be found as follows:  at t 0 a job of task i is released  a job in every higher priority task is also released at t 0  a (higher priority) deferrable server has:  a full budget e s at t 0  an asynchronous job is released at t 0,  a full asynchronous backlog exists for an extended time (beyond w i ), and  the next replenishment is at t 0 + e s 12/20/2015 Dr Alain Beaulieu

23 Critical Instants in Systems with Deferrable Servers  To understand the critical instant in the presence of a deferrable server, study the graph below  note how the worst case release time for any periodic task occurs when T DS has (and uses) its full budget just prior to getting a full replenishment t0t0 T1T1 T2T2 T DS eses eses eses eses eses 12/20/2015 Dr Alain Beaulieu

24 Time-Demand Analysis with Deferrable Servers (D i ≤ p i )  Understanding this formula: w i = e i + e s +  (w i -e s ) / p s  e s +   w i /p k  e k k  hp(i), excluding T DS execution of deferrable server immediately following critical instant 12/20/2015 Dr Alain Beaulieu

25 Time-Demand Analysis with Deferrable Servers (D i ≤ p i )  Understanding this formula: w i = e i + e s +  (w i -e s ) / p s  e s +   w i /p k  e k k  hp(i), excluding T DS interference of the deferrable server, T DS, in the interval (t 0 +e s, w i ] 12/20/2015 Dr Alain Beaulieu

26 Time-Demand Analysis with Deferrable Servers (D i ≤ p i )  Understanding this formula: w i = e i + e s +  (w i -e s ) / p s  e s +   w i /p k  e k k  hp(i), excluding T DS interference of all k higher priority tasks, excluding the deferrable server, T DS 12/20/2015 Dr Alain Beaulieu

27 Exercise  Draw the schedule for the system below  (go out far enough in time to include as a minimum the completion of the first job in each periodic task and all aperiodic jobs)  Determine the response time of A 1  Determine the worst case response time of all periodic tasks  Is the system schedulable?  T={ (5, 1.5), (7, 2) }  T DS = ( 4, 1), A = {(0.5, 2.5), (2.5, 0.25)} 12/20/2015 Dr Alain Beaulieu

28 Exercise Solution  draw the schedule for the system below 12/20/2015 Dr Alain Beaulieu

29 Exercise Solution  determine the response time of A 1 w A1 = 8.5 - 0.5 = 8 w A2 = 8.75 - 2.5 = 6.25  determine the worst case response time of all periodic tasks w 1 1 = e 1 + e s +  (w 1 0 -e s ) / p s  e s where w 1 0 = 1.5 = 1.5 + 1 +  (1.5 -1) / 4  (1) = 3.5 w 1 2 = 2.5 +  (3.5 -1) / 4  (1)= 3.5 therefore w 1 = 3.5  D 1 (worst-case) 12/20/2015 Dr Alain Beaulieu

30 Exercise Solution  determine the worst case response time of all periodic tasks (continued) w 2 1 = e 2 + e s +  (w 2 0 -e s ) / p s  e s +  (w 2 0 ) / p 1  e 1 w 2 0 = 2 = 2 + 1 +  (2 -1) / 4  (1) +  2 / 5  (1.5) = 5.5 w 2 2 = 3 +  (5.5 -1) / 4  (1) +  5.5 / 5  (1.5) = 8 w 2 3 = 3 +  (8 -1) / 4  (1) +  8/ 5  (1.5) = 8 therefore w 2 = 8 > D 2 (worst-case)  is the system schedulable? No since all tasks do not meet their deadlines under worst-case conditions, we can not guarantee the system schedulable 12/20/2015 Dr Alain Beaulieu

31 References [1] Liu, J.W.S., “Real-Time Systems”, Prentice-Hall, 2000. [2] Burns, A. and Wellings, A., “Real-Time Systems and Programming Languages”, Chapter 13, Addison Wesley, 1997 [3] TimeSys Corp, “The Concise Handbook of Real-Time Systems”, Version 1.0, 1999 12/20/2015 Dr Alain Beaulieu


Download ppt "Real Time Operating Systems Schedulability - Part 2 Course originally developed by Maj Ron Smith 12/20/2015Dr Alain Beaulieu1."

Similar presentations


Ads by Google