Real Real- -Time Systems Time Systems Deadline- Deadline - - PowerPoint PPT Presentation

real real time systems time systems deadline deadline
SMART_READER_LITE
LIVE PREVIEW

Real Real- -Time Systems Time Systems Deadline- Deadline - - PowerPoint PPT Presentation

EDA222/DIT160 Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #13 Updated 2009-02-24 Real Real- -Time Systems Time Systems Deadline- Deadline -monotonic scheduling monotonic scheduling Properties: Properties: Uses static


slide-1
SLIDE 1

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

Updated 2009-02-24

1

Real Real-

  • Time Systems

Time Systems

Verification Implementation Specification

  • Dynamic scheduling
  • - Deadline-monotonic

scheduling

  • Response-time analysis

Deadline Deadline-

  • monotonic scheduling

monotonic scheduling

Properties: Properties:

  • Uses static priorities

– Priority is determined by urgency: the task with the shortest relative deadline receives highest priority – Proposed as a generalization of rate-monotonic scheduling (J. Leung and J. W. Whitehead, 1982) Note that RM is a special case of DM, with Di = Ti

  • Theoretically well-established

– Exact feasibility test exists (an NP-complete problem) – 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

time analysis

The The response time response time for a task represents the worst for a task represents the worst-

  • case completion time of the task when execution

case completion time of the task when execution interference from other tasks are accounted for. interference from other tasks are accounted for.

i

R

i i i

I C R + =

i

τ

The response time for a task consists of: The response time for a task consists of: The task The task’ ’s uninterrupted execution time (WCET) s uninterrupted execution time (WCET) Interference from higher Interference from higher-

  • priority tasks

priority tasks

i

C

i

τ

i

I

Response Response-

  • time analysis

time analysis

Interference: Interference:

Consider two tasks, and , where has higher priority Consider two tasks, and , where has higher priority

i

τ

j

τ

j

τ Case 1:

j i i j i

C C R T R + = ⇒ ≤ <

t

5 10

j

T

i

R

j

C

i

C

i

τ

j

τ

slide-2
SLIDE 2

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

Updated 2009-02-24

2

Response Response-

  • time analysis

time analysis

Interference: Interference:

Consider two tasks, and , where has higher priority Consider two tasks, and , where has higher priority

i

τ

j

τ

j

τ Case 2:

j i i j i j

C C R T R T 2 2 + = ⇒ ≤ <

t

5 10

j

T

i

R

j

C

1 , i

C

2 , i

C

i

τ

j

τ

Response Response-

  • time analysis

time analysis

Interference: Interference:

i

τ

j

τ Task can be preempted by higher Task can be preempted by higher-

  • priority task .

priority task . The response time The response time f fö ör r is at most time units. is at most time units.

i

τ

i

R

i

τ

If , task can be preempted at most one time by

j i

T R ≤ <

j

τ

i

τ

If , task can be preempted at most two times by

j

τ

j i j

T R T 2 ≤ <

i

τ

If , task can be preempted at most three times by

j i j

T R T 3 2 ≤ < ...

j

τ

⎥ ⎥ ⎥ ⎤ ⎢ ⎢ ⎢ ⎡

j i

T R

The number of interferences from is limited by: The number of interferences from is limited by:

j

τ

j j i C

T R ⎥ ⎥ ⎥ ⎤ ⎢ ⎢ ⎢ ⎡ The total time for these interferences are: The total time for these interferences are:

Response Response-

  • time analysis

time analysis

Interference: Interference:

  • For static-priority scheduling, the interference term is

j i hp j j i i

C T R I

∈ ∀

⎥ ⎥ ⎥ ⎤ ⎢ ⎢ ⎢ ⎡ =

) (

where is the set of tasks with higher priority than . .

i

τ ) (i hp

  • The response time for a task is thus:

i

τ

∈ ∀

⎥ ⎥ ⎥ ⎤ ⎢ ⎢ ⎢ ⎡ + =

) (i hp j j j i i i

C T R C R

Response Response-

  • time analysis

time analysis

Interference: Interference:

  • The equation does not have a simple analytic solution.
  • However, an iterative procedure can be used:

∈ ∀ +

⎥ ⎥ ⎥ ⎤ ⎢ ⎢ ⎢ ⎡ + =

) ( 1 i hp j j j n i i n i

C T R C R

  • The iteration starts with a value that is guaranteed to be

less than or equal to the final value of (e.g. )

i

R

i i

R C =

  • The iteration completes at convergence ( ) or if

the response time exceeds some threshold (e.g. )

i

D

1 n n i i

R R

+ =

slide-3
SLIDE 3

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

Updated 2009-02-24

3

Exact feasibility test for DM Exact feasibility test for DM

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

A A sufficient and necessary sufficient and necessary condition for deadline condition for deadline-

  • monotonic scheduling, for which , is

monotonic scheduling, for which , is

The response The response-

  • time analysis and associated feasibility test

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

i i

D R i ≤ ∀ : where where is the response time for task is the response time for task

i

R

i

τ

i i

D T ≤

Exact feasibility test for DM Exact feasibility test for DM

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

The test is valid under the following assumptions: The test is valid under the following assumptions:

  • 1. All tasks are independent.

– There must not exist dependencies due to precedence

  • r mutual exclusion
  • 2. All tasks are periodic.
  • 3. Task deadline does not exceed the period ( ).
  • 4. Task preemptions are allowed.

i i

T D ≤

Example: scheduling using DM Example: scheduling using DM

Problem: Problem: Assume a system with tasks according to the figure

  • below. The timing properties of the tasks are given in the table.

a) Calculate the task response times. b) Show that the tasks are schedulable using DM c) What is the outcome of Liu & Layland’s feasibility test for RM?

We solve this on the whiteboard! We solve this on the whiteboard!

1

τ

2

τ

3

τ

Task Ci Di Ti 12 52 52 10 40 40 10 30 30

1

τ

2

τ

3

τ

The test can be extended to handle: The test can be extended to handle:

  • Blocking
  • Start-time variations (”release jitter”)
  • Time offsets
  • Deadlines exceeding the period
  • Overhead due to context switches, timers, interrupts, …

In this course, we only study blocking. In this course, we only study blocking.

Extended response Extended response-

  • time analysis

time analysis

slide-4
SLIDE 4

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

Updated 2009-02-24

4

Blocking can be accounted for in the following cases: Blocking can be accounted for in the following cases:

  • Blocking caused by critical regions

– Blocking factor represents the length of critical region(s) that are executed by processes with lower priority than

  • Blocking caused by non-preemptive scheduling

– Blocking factor represents largest WCET (not counting )

Extended response Extended response-

  • time analysis

time analysis

( ) i i i j j j hp i i

R R C C B T

∀ ∈

⎡ ⎤ = + + ⎢ ⎥ ⎢ ⎥

i

B

i

τ

i

B

i

τ

  • Note that the feasibility test is now only sufficient since

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

Blocking using ceiling priority protocol ICPP: Blocking using ceiling priority protocol ICPP:

H blocked L receives R’s ceiling priority (= H’s priority) L receives original priority

t

H

t

M normal execution critical region

priority (H) > priority (M) > priority (L)

t

L

H and L share resource R

Extended response Extended response-

  • time analysis

time analysis

Blocking caused by lower Blocking caused by lower-

  • priority tasks:

priority tasks:

  • This occurs if the lower-priority task is within a critical

region when arrives, and the critical region’s ceiling priority is higher than or equal to the priority of .

i

τ

i

τ

  • When using a priority ceiling protocol (such as ICPP),

a task can only be blocked once by a task with lower priority than .

i

τ

i

τ

i

B

i

τ

  • Blocking now means that the start time of is delayed

(= the blocking factor )

i

τ

  • As soon as has started its execution, it cannot be

blocked by a lower-priority task.

Extended response Extended response-

  • time analysis

time analysis

Determining the blocking factor for task : Determining the blocking factor for task :

i

τ

  • 1. Determine the ceiling priorities for all critical regions.

i

τ

i

τ

  • 2. Identify the tasks that have a priority lower than and

that calls critical regions with a ceiling priority equal to or higher than the priority of .

i

B

  • 3. Consider the times that these tasks lock the actual critical
  • regions. The longest of those times constitutes the blocking

factor .

Extended response Extended response-

  • time analysis

time analysis

slide-5
SLIDE 5

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

Updated 2009-02-24

5

Example: scheduling using DM Example: scheduling using DM

Problem: Problem: Assume a system with tasks according to the figure below.

The timing properties of the tasks are given in the table. Two semaphores S1 and S2 are used for synchronizing the tasks. The parameters HS1 and HS2 represent the longest time a task may lock semaphore S1 and S2, respectively.

S1 S2

1

τ

2

τ

3

τ

Task Ci Di Ti 2 4 25 3 12 12 8 24 5 HS1 HS2 1

  • 2
  • 1

1

1

τ

2

τ

3

τ

Example: scheduling using DM Example: scheduling using DM

Problem: (cont Problem: (cont’ ’d) d)

Examine the schedulability of the tasks when ICPP (Immediate Ceiling Priority Protocol) is used. a) Derive the ceiling priorities of the semaphores. b) Derive the blocking factors for the tasks. c) Show whether the tasks are schedulable or not.

We solve this on the whiteboard! We solve this on the whiteboard!