A presentation for Brian Evans Embedded Software Class
A presentation for Brian Evans’ Embedded Software Class For Real-Time Scheduling 3/2000 By Nate Forman Liaison Technology Inc. 3/30/2000 Rate Monotonic Analysis, Nate Forman
Agenda • Introduction • Anatomy of a Task • Rate Monotonic Principles and Tests • Extended Rate Monotonic Analysis • Demonstration • Mars Pathfinder Mission 3/2000 Rate Monotonic Analysis, Nate Forman
Introduction • Rate Monotonic refers to assigning priorities as a monotonic function of the rate (frequency of occurrence) of those processes. • Rate Monotonic Scheduling (RMS) can be accomplished based upon rate monotonic principles. • Rate Monotonic Analysis (RMA) can be performed statically on any hard real-time system concept to decide if the system is schedulable. 3/2000 Rate Monotonic Analysis, Nate Forman
Anatomy of a Task t 1 t 2 t 3 time Task Execution Time (C) 3/2000 End Of Period (T = Period Length) Rate Monotonic Analysis, Nate Forman
Rate Monotonic Assumptions • All tasks are periodic • Task switching is instantaneous • Tasks account for all processor execution time • Tasks become ready to execute precisely at the beginning of their periods and relinquish the CPU only when execution is complete 3/2000 Rate Monotonic Analysis, Nate Forman
Rate Monotonic Assumptions (2) • Task interactions are not allowed • Task deadlines are always at the end of the period • Tasks with shorter periods are assigned higher priorities; no other criteria are considered for priority assignment • Task execution is always consistent with rate monotonic priority: a lower priority task never executes when a higher priority task is ready 3/2000 Rate Monotonic Analysis, Nate Forman
Utilization Bound (UB) Test Processor Utilization for a task, i Utilization Bound for n tasks Ci Ui = U(n) = n(2 Ti 1 n - 1) Results: • If S Ui ≤ U(n) then the set of tasks is schedulable. • If S Ui > 1 then the set of tasks is unschedulable. • If U(n) < S Ui ≤ 1 then the test is inconclusive. 3/2000 Rate Monotonic Analysis, Nate Forman
UB Test Example Task Execution Time (C) Period (T) t 1 40 100 t 2 40 150 t 3 100 350 U 1 = 40 / 100 = 0. 4 U(3) = 3(21/3 – 1) = 0. 779 U 2 = 40 / 150 = 0. 267 Result: U 1+2 = 0. 667, schedulable. However, 0. 779 < 0. 953 < 1 Therefore, inconclusive for t 3. U 3 = 100 / 350 = 0. 286 Utotal = 0. 953 3/2000 Rate Monotonic Analysis, Nate Forman
Response Time (RT) Test Theorem: If a task meets its first deadline with worst-case task phasing, that deadline will always be met. For the response time for task i, find the least fixed-point of the following recurrence: a 0 = S Cj j H + {i} an+1 = Ci + S j H an Tj Cj where H is the set of tasks with higher priority than task i. 3/2000 Rate Monotonic Analysis, Nate Forman
RT Test Example a 0 = Task Execution Time (C) Period (T) t 1 40 100 t 2 40 150 t 3 100 350 S Cj = 40 + 100 = 180 j H + {i} a 1 = C 3 + S 180 Cj = 100 + (2 * 40) = 260 Tj a 2 = C 3 + S 260 Cj = 100 + (3 * 40) + (2 * 40) = 300 Tj a 3 = C 3 + S 300 Cj = 100 + (3 * 40) + (2 * 40) = 300 Tj j H j H 3/2000 a 2 = a 3 = 300 < t 3 = 350 t 3 is schedulable. Rate Monotonic Analysis, Nate Forman
Extensions to RMA • Aperiodic task handling • Preperiod task deadlines (Di = deadline for task i) • Nonzero task switching times (S = task switch time) • Interrupt handling for top-priority tasks • Task blocking and interaction through shared resources (Bi = blocking time for task i) 3/2000 Rate Monotonic Analysis, Nate Forman
Sporadic Servers • A conceptual task that uses its execution budget handling incoming aperiodic tasks • Its execution budget is only replenished after a period where it is completely consumed instead of after every period’s end. • Avoids deferred execution effect and reduces aperiodic tasks to the same model as periodic tasks 3/2000 Rate Monotonic Analysis, Nate Forman
Priority Inversion • A high priority task is ready to execute, but a lower priority task continues execution because it holds a lock on a shared resource that the high priority task needs. • Unbounded priority inversion occurs when a system allows tasks with lower priority than the blocked task to preempt the blocking task. 3/2000 Rate Monotonic Analysis, Nate Forman
Priority Inversion (2) • To successfully share resources, a system needs two properties: freedom from mutual deadlock, and bounded priority inversion. • The combination of priority inheritance and the priority ceiling protocol guarantee the above properties. Priority Inheritance: When a task blocks the execution of other, higher priority tasks, it executes at the highest priority of all of the tasks it blocks. 3/2000 Rate Monotonic Analysis, Nate Forman
Priority Ceiling Protocol • Priority Ceiling: of a binary semaphore is the highest priority of all of the tasks that may lock it. • A task attempting to a execute critical section is blocked unless its priority is higher than the priority ceilings of all of the locked semaphores in the system. • The task holding the lock on the highest priority ceiling semaphore inherits the priorities of tasks blocked in this way. 3/2000 Rate Monotonic Analysis, Nate Forman
Extended UB Test for Di = Di / Ti, redefine utilization bound: n ((2 Di)1/n – 1) + 1 – Di, 0. 5 < Di ≤ 1 D i, Di ≤ 0. 5 U(n, Di) = 3/2000 Rate Monotonic Analysis, Nate Forman
Extended UB Test (2) Updated processor utilization: fi = S j Hn Cj + 2 S Tj + Ci + 2 S Ti Bi + Ti + 1 Ti S (Ck + 2 S) k H 1 where Hn is the set of higher priority tasks that can preempt task i more than once (shorter periods) and H 1 are higher priority tasks that can preempt task i only once (longer periods) Compare each fi to its utilization bound, U(n, Di). The results can be interpreted as before. 3/2000 Rate Monotonic Analysis, Nate Forman
Extended RT Test Theorem: If a task meets its first deadline with worst-case task phasing, that deadline will always be met. The above theorem still stands although the deadline is Di instead of Ti. For the response time find the least fixed-point of the recurrence below: a 0 = Bi + S (Cj + 2 S) j H + {i} an+1 = Bi + Ci + 2 S + S j H an Tj (Cj + 2 S) where H is the set of tasks with higher priority than task i. 3/2000 Rate Monotonic Analysis, Nate Forman
What really happened on Mars? (the first time) • Two tasks were critical for controlling communication on the lander’s communication bus, the scheduler task (bc_sched) and the distribution task (bc_dist). • Each of these tasks checked each cycle to be sure that the other had run successfully. time = 0. 125 s bc_sched bc_dist bus active 3/2000 Rate Monotonic Analysis, Nate Forman
Mars Pathfinder: The Problem • bc_dist was blocked by a much lower priority meteorological science task (ASI/MET) • ASI/MET was preempted by several medium priority processes such as accelerometers and radar altimeters. • bc_sched started and discovered that bc_dist had not completed. Under these circumstances, bc_sched reacted by reinitializing the lander’s hardware and software and terminating all ground command activities. 3/2000 Rate Monotonic Analysis, Nate Forman
Mars Pathfinder: Resolution • “Faster, better, cheaper” had NASA and JPL using “shrinkwrap” hardware (IBM RS 6000) and software (Wind River vx. Works RTOS). • Logging designed into vx. Works enabled NASA and Wind River to reproduce the failure on Earth. This reproduction made the priority inversion obvious. • NASA patched the lander’s software to enable priority inheritance. 3/2000 Rate Monotonic Analysis, Nate Forman
Resources • www. sei. cmu. edu: Software Engineering Institute, technical reports and presentations on rate monotonic analysis • www. jpl. nasa. gov: NASA Jet Propulsion Laboratory, information about Mars missions, pictures • “Guaranteeing Real-Time Performance Using RMA, ” The Embedded Systems Conference, R. Obenza & G. Mendal • research. microsoft. com: letter by Glenn Reeves of JPL about Mars Pathfinder mission • http: //www. ece. utexas. edu/~bevans/courses/ee 382 c/projects/ fall 99/ -- The RMADriver Application 3/2000 Rate Monotonic Analysis, Nate Forman
- Slides: 22