Real-Time Scheduling David Ferry CSCI 3500 – Operating Systems Saint Louis University St. Louis, MO 63103
Real-Time Problem Domain “Real-time is not real fast” Some problems require high predictability and reliability, e.g. sense-compute-actuate loop at 10-1000Hz Cyber Physical Gather Sensor Data Sensors Compute Response Actuators Send Actuator Commands CSCI 3500 - Operating Systems
CSCI 3500 - Operating Systems Real-Time Task Model Multiple tasks, each with: Periodic rate, T Worst-case execution time, C Deadline relative to release time, D Note: There is no advantage to completing a job early! Task Period, T WCET, C Deadline, D A 3 1 B 5 1 3 5 8 13 B 6 4 2 10 A 7 9 11 12 14 15 CSCI 3500 - Operating Systems
Rate Monotonic (RM) Algorithm Preemptive Rate Monotonic – The task with the shortest period always executes as highest priority. B A A B B A B B A B B A B B A B 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 CSCI 3500 - Operating Systems
Earliest Deadline First (EDF) Preemptive Earliest Deadline First – The task with the next deadline always executes as highest priority. B A A B B B A B A B B A B B B A 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 CSCI 3500 - Operating Systems
Earliest Deadline First (EDF) Preemptive Earliest Deadline First – The task with the next deadline always executes as highest priority. B A EDF A B B B A B A B B A B B B A RM A B B A B B A B B A B B A B CSCI 3500 - Operating Systems
Real-Time Scheduling Problem Given a set of tasks, does a particular scheduling algorithm guarantee they will all get enough time to complete by their deadline, and how do we prove it? Here we can prove that RM and EDF work for this particular task set with an appeal to the hyperperiod... Is there a better way? What if hyperperiod was large? Restart EDF A B B B A B A B B A B B B A RM A B B A B B A B B A B B A B 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 CSCI 3500 - Operating Systems
CSCI 3500 - Operating Systems Schedulablity Tests RM and EDF are common names because they have rigorously proven schedulability tests that make it easy to decide whether they can schedule a task set or not. These are usually sufficient but not necessary. If a task set meets the criteria then we know it can be scheduled, but if it doesn’t meet the criteria we don’t know that it can’t be scheduled. For RM and EDF these tests are utilization bounds. CSCI 3500 - Operating Systems
CSCI 3500 - Operating Systems Utilization The utilization of a task is it’s execution requirement divided by its period. I.e. Ui = Ci / Ti so for example: The utilization of a task set is the sum all utilizations in the task set. Task Period, T WCET, C Deadline, D Utilization A 3 1 0.333 B 5 0.6 CSCI 3500 - Operating Systems
RM & EDF Utilization Bounds Liu and Layland (1973) proved that a set of n tasks is schedulable under RM if: U = ∑ Ci / Ti ≤ n(21/n – 1) Or for large n: U ≤ 0.69 Xu and Parnas (1990) proved a set of tasks is schedulable under EDF if: U = ∑ Ci / Ti ≤ 1 CSCI 3500 - Operating Systems
Sufficiency vs. Necesscity Schedulability tests are only sufficient, not necessary: E.g.: Utilization of this task set is 0.933 Schedulability bound from last slide for n=2: U ≤ n(21/n – 1) = 2*(√2 - ) = 0.83 Task Period, T WCET, C Deadline, D Utilization A 3 1 0.333 B 5 0.6 A B RM CSCI 3500 - Operating Systems