real time systems time systems real
play

Real- -Time Systems Time Systems Real Specification Dynamic - PDF document

EDA222/DIT160 Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #14 Updated 2009-03-01 Real- -Time Systems Time Systems Real Specification Dynamic scheduling Implementation -- Earliest-deadline-first scheduling


  1. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #14 Updated 2009-03-01 Real- -Time Systems Time Systems Real Specification • Dynamic scheduling Implementation -- Earliest-deadline-first scheduling • Processor-demand analysis Verification Example: scheduling using EDF Example: scheduling using EDF Problem: Problem: Assume a system with tasks according to the figure below. The timing properties of the tasks are given in the table. Investigate the schedulability of the tasks when EDF is used. (Note that D i < T i for all tasks) Task C i D i T i τ τ τ τ 1 1 2 1 2 3 1 τ 1 2 4 2 τ 1 3 8 3

  2. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #14 Updated 2009-03-01 Example: scheduling using EDF Example: scheduling using EDF Simulate an execution of the tasks: τ 1 τ τ misses its deadline! 3 2 τ 3 t 0 2 4 6 8 The tasks are not schedulable even though U = 1 2 + 1 4 + 1 8 = 7 8 = 0.875 < 1 Feasibility analysis for EDF Feasibility analysis for EDF What analysis methods are suitable for general EDF: What analysis methods are suitable for general EDF: • Utilization-based analysis? Not suitable! Not general enough or exact enough – Does not work well for the case of D i < T • Response-time analysis? Not suitable! Analysis much more complex than for DM – Critical instant does not necessarily occur when all tasks arrive at the same time for the first time – Instead, response time of a task is maximized at some scenario where all other tasks arrive at the same time; the worst such scenario has to be identified for each task before the response time of that task can be calculated

  3. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #14 Updated 2009-03-01 Processor- -demand analysis demand analysis Processor Processor demand: Processor demand: • The processor demand for a task in a given time τ i [ ] interval is the amount of processor time that the 0, L task needs in the interval in order to meet the deadlines that fall within the interval. • Let represent the number of instances of that must τ L N i i complete execution before . L • The total processor demand up to is L n ∑ C P (0, L ) = L C i N i i = 1 Processor- -demand analysis demand analysis Processor Processor demand: Processor demand: • We can calculate by counting how many times task τ L N i i ⎡ ⎤ 0, L − D i has arrived during the interval . ⎣ ⎦ • We can ignore instances of the task that arrived during D i > L L − D i , L ⎡ ⎤ the interval since for these instances. ⎣ ⎦ D i > L Instance with τ = L 2 N 1 1 = L 3 N τ 2 2 t 0 L

  4. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #14 Updated 2009-03-01 Processor- -demand analysis demand analysis Processor Processor- -demand analysis: demand analysis: Processor • We can express as L N i L − D i ⎢ ⎥ L = ⎥ + 1 ⎢ N i ⎣ ⎦ T i • The total processor demand is thus L − D i ⎛ ⎢ ⎥ ⎞ n ∑ C P (0, L ) = ⎥ + 1 ⎢ ⎜ ⎟ C i ⎝ ⎠ ⎣ ⎦ T i i = 1 Exact feasibility test for EDF Exact feasibility test for EDF (Sufficient and necessary condition) (Sufficient and necessary condition) A sufficient and necessary sufficient and necessary condition for earliest condition for earliest- - A D i ≤ T i deadline- -first scheduling, for which , is first scheduling, for which , is deadline ∀ L : C P (0, L ) ≤ L [ ] where is the total processor demand in . where is the total processor demand in . 0, L C P (0, L ) The processor- -demand analysis and associated feasibility test demand analysis and associated feasibility test The processor was presented by S. was presented by S. Baruah Baruah, L. Rosier and R. Howell in 1990. , L. Rosier and R. Howell in 1990.

  5. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #14 Updated 2009-03-01 Exact feasibility test for EDF Exact feasibility test for EDF (Sufficient and necessary condition) (Sufficient and necessary condition) How large interval must be examined? How large interval must be examined? • Largest interval is LCM of the task • Largest interval is LCM of the task’ ’s periods s periods How many time points must be examined? How many time points must be examined? • Only absolute deadlines need to be examined • Only absolute deadlines need to be examined The test can consequently be improved as follows: The test can consequently be improved as follows: ∀ L ∈ K : C P (0, L ) ≤ L { } { } = = + ≤ ≤ ≤ ≥ k | k , k LCM , , ,1 , 0 K D D kT D D T T i n k i i i i i 1 n … Example: scheduling using EDF Example: scheduling using EDF Problem: Problem: Assume a system with tasks according to the figure below. The timing properties of the tasks are given in the table. a) Determine, by analyzing the processor demand, whether the tasks are schedulable or not using EDF. b) Determine, by using simulation, whether the tasks are schedulable or not using EDF. Task C i D i T i τ τ τ τ 2 3 4 1 3 1 2 τ 2 7 8 2 τ 3 12 16 3 We solve this on the whiteboard! We solve this on the whiteboard!

  6. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #14 Updated 2009-03-01 Extended processor processor- -demand analysis demand analysis Extended The test can be extended to handle: The test can be extended to handle: • Blocking • Start-time variations (”release jitter”) • Time offsets • … In this course, we only study blocking. In this course, we only study blocking. Deadline inversion Deadline inversion H and L share resource R normal execution critical region H misses its deadline H blocked H t M t L t 1 t 2 t

  7. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #14 Updated 2009-03-01 Stack Resource Policy (SRP) Stack Resource Policy (SRP) The tasks are assigned The tasks are assigned preemption levels preemption levels, the properties of , the properties of which are: which are: τ i π i – – The preemption level of task is denoted The preemption level of task is denoted π i > π j τ i τ j – – Task is not allowed to preempt another task unless Task is not allowed to preempt another task unless τ i τ j τ i – If has higher priority than and arrives later, then – If has higher priority than and arrives later, then must must τ j have a higher preemption level than . have a higher preemption level than . Note: Note: - - The preemption levels are static values, even though the tasks The preemption levels are static values, even though the tasks priorities may be dynamic. priorities may be dynamic. - For EDF scheduling, suitable levels can be derived if tasks with - For EDF scheduling, suitable levels can be derived if tasks with shorter relative deadlines get higher preemption levels, that is: shorter relative deadlines get higher preemption levels, that is : π i > π j ⇔ D i < D j Stack Resource Policy (SRP) Stack Resource Policy (SRP) Deadline inversion can be reduced with Deadline inversion can be reduced with resource ceilings resource ceilings: : 1. Each shared resource is assigned a ceiling that is always 1. Each shared resource is assigned a ceiling that is always equal to the maximum preemption level among all tasks that equal to the maximum preemption level among all tasks that may be blocked when requesting the resource. may be blocked when requesting the resource. 2. The protocol keeps a system system- -wide ceiling wide ceiling that is equal to the that is equal to the 2. The protocol keeps a maximum of the current ceilings of all resources. maximum of the current ceilings of all resources. 3. 3. A task with the earliest deadline is allowed to preempt only if A task with the earliest deadline is allowed to preempt only if its preemption level is higher than the system its preemption level is higher than the system- -wide ceiling. wide ceiling. Note: Note: – – The original priority of the task is not changed at run The original priority of the task is not changed at run- -time. time. – – The resource ceiling is a dynamic value calculated at run- The resource ceiling is a dynamic value calculated at run -time time as a function of current resource availability. as a function of current resource availability. – – Otherwise, the behavior of the protocol is very similar to the Otherwise, the behavior of the protocol is very similar to the ICPP, and SRP also exhibits identical properties regarding ICPP, and SRP also exhibits identical properties regarding maximum blocking time and freedom from deadlock. maximum blocking time and freedom from deadlock.

Recommend


More recommend