You are on page 1of 5

EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #13

Updated 2009-02-24

Real-
Real-Time Systems Deadline-
Deadline-monotonic scheduling

Properties:
• Uses static priorities
Specification – Priority is determined by urgency: the task with the shortest
relative deadline receives highest priority
– Proposed as a generalization of rate-monotonic scheduling
• Dynamic scheduling
(J. Leung and J. W. Whitehead, 1982)
Implementation -- Deadline-monotonic
scheduling Note that RM is a special case of DM, with Di = Ti
• Response-time analysis
• Theoretically well-established
– Exact feasibility test exists (an NP-complete problem)
Verification – DM is optimal among all scheduling algorithms that use static
task priorities for which Di ≤ Ti
(shown by J. Leung and J. W. Whitehead in 1982)

Response-
Response-time analysis Response-
Response-time analysis

The response time Ri for a task τ i represents the worst-


worst- Interference:
case completion time of the task when execution Consider two tasks, τ i and τ j , where τ j has higher priority
interference from other tasks are accounted for.
Case 1: 0 < Ri ≤ T j ⇒ Ri = Ci + C j
The response time for a task τ i consists of:
Ri
Ci The task’
task’s uninterrupted execution time (WCET) Ci
I i Interference from higher-
higher-priority tasks τi
Tj
Cj
Ri = Ci + I i
τj

0 5 10 t

1
EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #13
Updated 2009-02-24

Response-
Response-time analysis Response-
Response-time analysis

Interference: Interference:
Consider two tasks, τ i and τ j , where τ j has higher priority Task τ i can be preempted by higher-
higher-priority task τ j.
The response time för τ i is at most Ri time units.
Case 2: T j < Ri ≤ 2T j ⇒ Ri = Ci + 2C j
If 0 < Ri ≤ T j , task τ i can be preempted at most one time by τ j
Ri
Ci , 1 Ci , 2 If T j < Ri ≤ 2T j , task τ i can be preempted at most two times by τ j
If 2T j < Ri ≤ 3T j , task τ i can be preempted at most three times by τ j
τi
Tj ...
⎡ Ri ⎤
Cj The number of interferences from τ j is limited by: ⎢ ⎥
τj ⎢Tj ⎥
⎡ Ri ⎤
The total time for these interferences are: ⎢ ⎥Cj
0 5 10 t ⎢Tj ⎥

Response-
Response-time analysis Response-
Response-time analysis

Interference: Interference:
• For static-priority scheduling, the interference term is • The equation does not have a simple analytic solution.
⎡R ⎤ • However, an iterative procedure can be used:
Ii = ∑ ⎢ i ⎥ C j
∀j∈hp ( i ) ⎢ T j ⎥ ⎡ Rin ⎤
where hp (i ) is the set of tasks with higher priority than τ i .
Rin +1 = Ci + ∑ ⎢ ⎥Cj
∀j∈hp ( i ) ⎢ T j ⎥
• The response time for a task τ i is thus:
• The iteration starts with a value that is guaranteed to be
less than or equal to the final value of Ri (e.g. Ri = Ci )
0
⎡R ⎤
Ri = Ci + ∑ ⎢ i ⎥ C j • The iteration completes at convergence ( Rin +1 = Rin) or if
∀j∈hp (i ) ⎢ T j ⎥ the response time exceeds some threshold (e.g. Di )

2
EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #13
Updated 2009-02-24

Exact feasibility test for DM Exact feasibility test for DM


(Sufficient and necessary condition) (Sufficient and necessary condition)

A sufficient and necessary condition for deadline-


deadline- The test is valid under the following assumptions:
monotonic scheduling, for which Di ≤ Ti , is 1. All tasks are independent.
– There must not exist dependencies due to precedence
or mutual exclusion
∀i : Ri ≤ Di 2. All tasks are periodic.
3. Task deadline does not exceed the period ( Di ≤ Ti ).
4. Task preemptions are allowed.
where Ri is the response time for task τ i

The response-
response-time analysis and associated feasibility test
was presented by M. Joseph and P. Pandya in 1986.

Example: scheduling using DM Extended response-


response-time analysis

Problem: Assume a system with tasks according to the figure The test can be extended to handle:
below. The timing properties of the tasks are given in the table.
a) Calculate the task response times. • Blocking
b) Show that the tasks are schedulable using DM • Start-time variations (”release jitter”)
c) What is the outcome of Liu & Layland’s feasibility test for RM?
• Time offsets
• Deadlines exceeding the period
Task Ci Di Ti
τ1 τ2 τ3 τ1 12 52 52 • Overhead due to context switches, timers, interrupts, …
τ2 10 40 40
τ3 10 30 30
In this course, we only study blocking.

We solve this on the whiteboard!

3
EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #13
Updated 2009-02-24

Extended response-
response-time analysis Extended response-
response-time analysis

Blocking can be accounted for in the following cases: Blocking using ceiling priority protocol ICPP:
• Blocking caused by critical regions priority (H) > priority (M) > priority (L)
normal execution H and L share resource R
– Blocking factor Bi represents the length of critical region(s) that
are executed by processes with lower priority than τ i critical region
• Blocking caused by non-preemptive scheduling H blocked
L receives R’s ceiling priority (= H’s priority)

– Blocking factor Bi represents largest WCET (not counting τ i ) L receives original priority

H
t
⎡R ⎤
Ri = Ci + Bi +∑ ⎢ i ⎥ C j
∀j∈hp ( i ) ⎢ T j ⎥ M
t

• Note that the feasibility test is now only sufficient since L


the worst-case blocking will not always occur at run-time. t

Extended response-
response-time analysis Extended response-
response-time analysis

Blocking caused by lower-


lower-priority tasks: Determining the blocking factor for task τ i :
• When using a priority ceiling protocol (such as ICPP),
a task τ i can only be blocked once by a task with lower 1. Determine the ceiling priorities for all critical regions.
priority than τ i . 2. Identify the tasks that have a priority lower than τ i and
• This occurs if the lower-priority task is within a critical that calls critical regions with a ceiling priority equal to or
region when τ i arrives, and the critical region’s ceiling higher than the priority of τ i .
priority is higher than or equal to the priority of τ i .
3. Consider the times that these tasks lock the actual critical
• Blocking now means that the start time of τ i is delayed regions. The longest of those times constitutes the blocking
(= the blocking factor Bi ) factor Bi .
• As soon as τ i has started its execution, it cannot be
blocked by a lower-priority task.

4
EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #13
Updated 2009-02-24

Example: scheduling using DM Example: scheduling using DM

Problem: Assume a system with tasks according to the figure below. Problem: (cont’
(cont’d)
The timing properties of the tasks are given in the table.
Examine the schedulability of the tasks when ICPP (Immediate
Two semaphores S1 and S2 are used for synchronizing the tasks.
Ceiling Priority Protocol) is used.
The parameters HS1 and HS2 represent the longest time a task may
a) Derive the ceiling priorities of the semaphores.
lock semaphore S1 and S2, respectively.
b) Derive the blocking factors for the tasks.
c) Show whether the tasks are schedulable or not.
τ1 τ2 τ3 Task Ci Di Ti HS1 HS2
τ1 2 4 5 1 1
τ2 3 12 12 1 -
We solve this on the whiteboard!
S1 S2 τ3 8 24 25 - 2

You might also like