Real Time Operating Systems Schedulability - Part 2 Course originally developed by Maj Ron Smith 12/20/2015Dr Alain Beaulieu1.
Post on 18-Jan-2016
219 Views
Preview:
Transcript
Real Time Operating Systems
Schedulability - Part 2
Course originally developed by Maj Ron Smith
04/21/23 Dr Alain Beaulieu 1
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
04/21/23 Dr Alain Beaulieu
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
04/21/23 Dr Alain Beaulieu
Alternatives
When utilization based tests are inconclusive, we can always construct a timing graph of the system construct graph over the interval [0, max {pi}]
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
04/21/23 Dr Alain Beaulieu
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 Ti occurs when it releases at the same time as a job in each higher priority task
04/21/23 Dr Alain Beaulieu
Critical Instants
Example 1: T= { (3,1), (5, 1), (10, 2) }
The critical instant for tasks T2 and T3 is 0
0 2 4 6 12
T1
T2
T3
8 10
1
1
1
1 1 1
1 1
1 1
In fact for in phase tasks, a critical instant always exists at t = 0
04/21/23 Dr Alain Beaulieu
Critical Instants
Example 2: T= { (1,3,1,3), (5, 1), (10, 2) }
The critical instant for tasks T2 and T3 is 10
0 2 4 6 12
T1
T2
T3
8 10
1
1
1
1 1 1
1 1
1 1
04/21/23 Dr Alain Beaulieu
Time-Demand Analysis (Di ≤ pi)
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
04/21/23 Dr Alain Beaulieu
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 ->
wi = ei + Ii (1)
where Ii is the maximum interference* that task i can experience in any time interval [t, wi )
*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)
04/21/23 Dr Alain Beaulieu
Counting Releases
Consider task i and a higher priority task j now, the number of releases of task j in time
interval 0 to wi can be derived as follows:
# of releases j = wi/pj (2)
ceiling function[ 0, wi )
0 100 200
i
j 40
40
40
5
pipj
# of releases = 2
wi
04/21/23 Dr Alain Beaulieu
Determining Interference
From this, the maximum interference of task j on task i in interval 0 to wi is given by:
max interference (task j) = wi/pj ej (3)
but there may be other higher priority tasks,
therefore:
Ii = wi/pj ej (4)
[ 0, wi )
jhp(i)
04/21/23 Dr Alain Beaulieu
Calculating Response Time
Substituting equation (4) into (1) gives the general expression for response time:
wi = ei + wi/pj ej (5)
Note the following issue (problem):
wi is on both sides of this “strange” equation
Before we attempt to solve this equation, let’s
first see if we can understand it
jhp(i)
04/21/23 Dr Alain Beaulieu
Understanding Response Time
T = { (100, 20), (150, 30), (250, 60) }
w3 = e3 + w3/p1 e1 + w3/p2 e2
= 60 + 2(20) + 1(30) {by viewing the
graph}
= 130
0 100 200
T1
T2
T3
w3 = 130
04/21/23 Dr Alain Beaulieu
Solving the Response Time Equation
Essentially, form a recursive relationship with equation (5) and solve iteratively:
win+1 = ei + wi
n / pj ej (6)
where initial (seed) value wi0 = ei
The algorithm then becomes:solve for successive values of wi
n+1
if win+1 = wi
n , then solution found -> wi = win
if win+1 > Di , then task i cannot meet its deadline
jhp(i)
04/21/23 Dr Alain Beaulieu
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
exercise to be completed in classexercise to be completed in class
04/21/23 Dr Alain Beaulieu
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
04/21/23 Dr Alain Beaulieu
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
04/21/23 Dr Alain Beaulieu
DMPO Example
Task ei pi Di i wi *
1 3 20 5 1 3 2 3 15 7 2 6
3 4 10 10 3 10 4 3 20 20 4 20
* Response times are calculated using the methods presented earlier using equation (6)
Note that a rate monotonic ordering would not schedule these tasks
04/21/23 Dr Alain Beaulieu
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?
04/21/23 Dr Alain Beaulieu
Recall: Deferrable Servers
A deferrable server is a bandwidth preserving server with period ps and execution budget es 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
04/21/23 Dr Alain Beaulieu
Recall the Deferrable Server Example
The schedule for this system is given below:T= {(2, 3.5, 1.5, 3.5), (6, 0.5) }TDS = (3,1)
A1 = (2.5, 2)
0 2 4
T1
T2
TDS
6 8
1/2
1/2
1 1
1/2
1/2 1 1/2
1/2
2.5 5.5
Note: = {TDS, T1, T2}
04/21/23 Dr Alain Beaulieu
Critical Instants & Systems with Deferrable Servers
In order to use time demand analysis on a system with a deferrable server, a critical instant, t0, must be found as follows: at t0 a job of task i is released
a job in every higher priority task is also released at t0
a (higher priority) deferrable server has: a full budget es at t0
an asynchronous job is released at t0,
a full asynchronous backlog exists for an extended time (beyond wi), and
the next replenishment is at t0 + es
04/21/23 Dr Alain Beaulieu
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 TDS has (and uses) its full budget just prior to getting a full replenishment
t0
T1
T2
TDS es es es es es
04/21/23 Dr Alain Beaulieu
Time-Demand Analysis with Deferrable Servers (Di ≤ pi)
Understanding this formula:
wi = ei + es + (wi-es) / ps es + wi/pk ekkhp(i), excluding TDS
execution of deferrable server immediately following critical instant
04/21/23 Dr Alain Beaulieu
Time-Demand Analysis with Deferrable Servers (Di ≤ pi)
Understanding this formula:
wi = ei + es + (wi-es) / ps es + wi/pk ekkhp(i), excluding TDS
interference of the deferrable server, TDS, in the interval (t0+es , wi]
04/21/23 Dr Alain Beaulieu
Time-Demand Analysis with Deferrable Servers (Di ≤ pi)
Understanding this formula:
wi = ei + es + (wi-es) / ps es + wi/pk ekkhp(i), excluding TDS
interference of all k higher priority tasks, excluding the deferrable server, TDS
04/21/23 Dr Alain Beaulieu
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 A1
Determine the worst case response time of all periodic tasks
Is the system schedulable? T={ (5, 1.5), (7, 2) } TDS = ( 4, 1) , A = {(0.5, 2.5), (2.5, 0.25)}
04/21/23 Dr Alain Beaulieu
Exercise Solution
draw the schedule for the system belowT={ (5, 1.5), (7, 2) } TDS = ( 4, 1) , A = {(0.5, 2.5), (2.5, 0.25)}
Tasks
T2
T1
TDS
6 8 t0 2 4
A1 A1 A1A2
04/21/23 Dr Alain Beaulieu
Exercise Solution
determine the response time of A1
wA1 = 8.5 - 0.5 = 8
wA2 = 8.75 - 2.5 = 6.25
determine the worst case response time of all periodic tasks
w11 = e1 + es + (w1
0-es) / ps es where w10 = 1.5
= 1.5 + 1 + (1.5 -1) / 4 (1) = 3.5w1
2 = 2.5 + (3.5 -1) / 4 (1) = 3.5
therefore w1 = 3.5 D1 (worst-case)
04/21/23 Dr Alain Beaulieu
Exercise Solution
determine the worst case response time of all periodic tasks (continued)
w21 = e2 + es + (w2
0-es) / ps es + (w20) / p1 e1 w2
0 = 2
= 2 + 1 + (2 -1) / 4 (1) + 2 / 5 (1.5) = 5.5w2
2 = 3 + (5.5 -1) / 4 (1) + 5.5 / 5 (1.5) = 8
w23 = 3 + (8 -1) / 4 (1) + 8/ 5 (1.5) = 8
therefore w2 = 8 > D2 (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
04/21/23 Dr Alain Beaulieu
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
04/21/23 Dr Alain Beaulieu
top related