real real time systems time systems deadline deadline
play

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


  1. 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 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 Note that RM is a special case of DM, with D i = T i scheduling • Theoretically well-established • Response-time analysis – Exact feasibility test exists (an NP-complete problem) Verification – DM is optimal among all scheduling algorithms that use static task priorities for which D i ≤ T i (shown by J. Leung and J. W. Whitehead in 1982) Response- -time analysis time analysis Response- -time analysis time analysis Response Response τ The response time response time for a task represents the worst- - Interference: Interference: The R for a task represents the worst i i τ τ τ case completion time of the task when execution case completion time of the task when execution Consider two tasks, and , where has higher priority Consider two tasks, and , where has higher priority i j j interference from other tasks are accounted for. interference from other tasks are accounted for. < ≤ ⇒ = + Case 1: 0 R T R C C τ i j i i j The response time for a task consists of: The response time for a task consists of: i R i C The task The task’ ’s uninterrupted execution time (WCET) s uninterrupted execution time (WCET) i C i I Interference from higher- -priority tasks priority tasks Interference from higher τ i i T j = + C R C I j i i i τ j 0 5 10 t 1

  2. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #13 Updated 2009-02-24 Response- Response -time analysis time analysis Response- Response -time analysis time analysis Interference: Interference: Interference: Interference: τ τ τ τ τ Consider two tasks, and , where has higher priority Consider two tasks, and , where has higher priority Task can be preempted by higher- Task can be preempted by higher -priority task . priority task . j j i i j τ The response time f The response time fö ör r is at most time units. is at most time units. R < ≤ ⇒ = + Case 2: T R 2 T R C 2 C i i j i j i i j τ < R ≤ τ If 0 T , task can be preempted at most one time by i j i j R i < ≤ τ τ If , task can be preempted at most two times by T R 2 T C C j i j i j i , 1 i , 2 τ < ≤ τ If T R T , task can be preempted at most three times by 2 3 τ j i j i j i ... T ⎡ ⎤ j R τ ⎢ ⎥ i C The number of interferences from is limited by: The number of interferences from is limited by: j j ⎢ ⎥ T ⎢ ⎥ τ ⎡ ⎤ j R j i C ⎢ ⎥ The total time for these interferences are: The total time for these interferences are: j ⎢ ⎥ T ⎢ ⎥ 5 0 10 j t Response- -time analysis time analysis Response- -time analysis time analysis Response Response Interference: Interference: Interference: Interference: • For static-priority scheduling, the interference term is • The equation does not have a simple analytic solution. • However, an iterative procedure can be used: ⎡ ⎤ R ∑ = ⎢ ⎥ i I C i j ⎢ ⎥ T ⎢ ⎥ ⎡ ⎤ ∀ ∈ j hp ( i ) j n ∑ R + = + ⎢ ⎥ n 1 i R C C τ . where is the set of tasks with higher priority than hp ( i ) . i i j ⎢ ⎥ T ⎢ ⎥ i ∀ ∈ j hp i ( ) j • The response time for a task is thus: τ i • The iteration starts with a value that is guaranteed to be = 0 ⎡ ⎤ R C less than or equal to the final value of (e.g. ) R ∑ R + = i i i = + ⎢ ⎥ • The iteration completes at convergence ( ) or if i R C C n 1 n R R i i j ⎢ ⎥ i i ⎢ T ⎥ ∀ ∈ j hp ( i ) the response time exceeds some threshold (e.g. ) D j i 2

  3. 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 Exact feasibility test for DM Exact feasibility test for DM (Sufficient and necessary condition) (Sufficient and necessary condition) (Sufficient and necessary condition) (Sufficient and necessary condition) A sufficient and necessary A sufficient and necessary condition for deadline condition for deadline- - The test is valid under the following assumptions: The test is valid under the following assumptions: ≤ monotonic scheduling, for which , is monotonic scheduling, for which , is D T 1. All tasks are independent. i i – There must not exist dependencies due to precedence or mutual exclusion ∀ : ≤ i R D 2. All tasks are periodic. i i D ≤ 3. Task deadline does not exceed the period ( ). T i i 4. Task preemptions are allowed. τ where where R is the response time for task is the response time for task i i 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. Example: scheduling using DM Extended response- -time analysis time analysis Example: scheduling using DM Extended response Problem: Assume a system with tasks according to the figure Problem: The test can be extended to handle: The test can be extended to handle: below. The timing properties of the tasks are given in the table. • Blocking a) Calculate the task response times. • Start-time variations (”release jitter”) b) Show that the tasks are schedulable using DM c) What is the outcome of Liu & Layland’s feasibility test for RM? • Time offsets • Deadlines exceeding the period Task C i D i T i • Overhead due to context switches, timers, interrupts, … τ τ τ τ 12 52 52 1 1 2 3 τ 10 40 40 2 τ 10 30 30 In this course, we only study blocking. In this course, we only study blocking. 3 We solve this on the whiteboard! We solve this on the whiteboard! 3

  4. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #13 Updated 2009-02-24 Extended response Extended response- -time analysis time analysis Extended response- Extended response -time analysis time analysis Blocking using ceiling priority protocol ICPP: Blocking using ceiling priority protocol ICPP: Blocking can be accounted for in the following cases: Blocking can be accounted for in the following cases: • Blocking caused by critical regions priority (H) > priority (M) > priority (L) normal execution H and L share resource R – Blocking factor represents the length of critical region(s) that B i τ are executed by processes with lower priority than critical region i • Blocking caused by non-preemptive scheduling L receives R’s ceiling priority (= H’s priority) H blocked τ L receives original priority – Blocking factor represents largest WCET (not counting ) B i i H t ⎡ ⎤ ∑ R = + + i R C B ⎢ ⎥ C i i i j ⎢ ⎥ T M ∀ ∈ j hp ( ) i j 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- -time analysis time analysis Extended response- -time analysis time analysis Extended response Extended response τ Blocking caused by lower- -priority tasks: priority tasks: Determining the blocking factor for task : Blocking caused by lower Determining the blocking factor for task : i • When using a priority ceiling protocol (such as ICPP), τ 1. Determine the ceiling priorities for all critical regions. a task can only be blocked once by a task with lower i τ priority than . τ 2. Identify the tasks that have a priority lower than and i i • This occurs if the lower-priority task is within a critical that calls critical regions with a ceiling priority equal to or τ τ higher than the priority of . region when arrives, and the critical region’s ceiling i 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 is delayed τ regions. The longest of those times constitutes the blocking i factor . (= the blocking factor ) B B i i • As soon as has started its execution, it cannot be τ i blocked by a lower-priority task. 4

Recommend


More recommend