1 / 29

Special Class on Real-Time Systems

Explore the world of real-time systems, including applications, research areas, and scheduling algorithms such as Earliest Deadline First (EDF) and Rate Monotonic (RM). Learn about the standard real-time system model and the challenges of scheduling jobs with dependencies and resource sharing.

Download Presentation

Special Class on Real-Time Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Special Class on Real-Time Systems

  2. Real-time vs. general operating system • In addition to requiring logical correctness, real-time systems require temporal correctness • Logical correctness: Given an input, the system must create the correct output • Temporal correctness: The correct output must be created at the correct time

  3. Real-time applications • Real-time systems are used in a variety of applications • Safety critical systems • Airplane autopilot, power plant controllers • Expensive systems • Satellite controllers, Mars rovers • Other time critical applications • Radar system, Sensor networks • Consumer and embedded devices • Cell phones

  4. Aspects of real-time research • There are many active areas of research real-time systems • Scheduling algorithms • Schedulability tests • Strategies for reducing power consumption • Real-time operating systems • Real-time programming languages • Specific real-time applications • Hardware for real-time systems

  5. Standard real-time system model • Periodic tasks: A mechanism for executing a job repeatedly at regular time intervals • Example: Taking the temperature and initiating appropriate response in a power plant controller • T = (e,p) • e = execution requirement • p = period

  6. Example • T = (3,5) • This task generates a new job every 5 time units • Each job will require at most 3 time units to execute • The deadline of each job is equal to the arrival time of the next job

  7. Task utilization • Given a periodic task T = (e,p), the utilization of T is e/p • Proportion of processing time this task will require on average • Many schedulability tests are based on task utilization

  8. Two common scheduling algorithms • Earliest Deadline First (EDF) • Jobs with earlier deadlines are given higher priority • Rate Monotonic (RM) • Jobs generated by tasks with shorter periods are given higher priority

  9. Example RM and EDF schedules Three tasks, T1 = (0.5,3), T2 = (1,4), T3 = (2,6) RM T1 T2 T1 T3 T2 EDF T3 EDF will meet all deadlines if it is possible to do so We say EDF is optimal on uniprocessors

  10. Utilization-based EDF test • Given a set of periodic tasks τ= {T1 =(e1,p1), T2=(e2,p2), …, Tn=(en,pn)} • Let U = Σ ei/pi be the total utilization of τ • If U ≤ 1, then τ can be successfully scheduled using preemptive EDF • No jobs will miss their deadlines

  11. Utilization-based RM test • Given a set of periodic tasks τ= {T1 =(e1,p1), T2=(e2,p2), …, Tn=(en,pn)} • Let U = Σ ei/pi be the total utilization of τ • If U ≤ ln 2 (≈ 0.69), then τ can be successfully scheduled using preemptive RM • Why use RM? • Many real-time operating systems can only schedule tasks with fixed priority • All jobs generated by the same task must have the same priority

  12. Shortcomings of periodic task model • The periodic tasks are assumed to all start at the same time • We can easily add an offset to the task description T = (o,e,p) • Not all tasks can have the job’s deadline equal to the task’s period • We can easily add a deadline to the task description T = (o,e,p,d)

  13. More serious shortcomings • The model provided assumes all tasks are independent • Jobs may share resources • In this case, one job may block another job • One job may generate data that will be used by another job • In this case, we would want to impose a precedence constraint on these jobs

  14. Scheduling jobs with dependiencies • Both blocking and precedence constraints can cause priority inversion and timing anomolies • Priority inversion: A higher priority job may be forced to wait while a lower priority job executes • Timing anomolies: Reducing the execution of one job may cause another job finish execution at a later time

  15. = access of single-unit resource R Priority inversion J1 J2 J3 14 18 16 8 0 6 12 4 10 2

  16. Timing anomalies When tasks share resources, there may be timing anomalies. Example:Reducing J3’s critical section from 4 time units to 2.5 causes J1 to miss its deadline! J1 J2 J3 14 18 16 8 0 6 12 4 10 2

  17. Multiprocessor Scheduling • Scheduling analysis is much more difficult on multiprocessors • Many tests can only guarantee feasibility when the utilization is approximately m/2, where m is the number of processors • Things get even more complicated when there is resource sharing or precedence constraints

  18. Multiprocessor Scheduling • Hong and Leung used the following example to prove that no online scheduling algorithm can be optimal • J1 = J2 = (0; 2; 4); J3 = (0; 4; 8) • Later arrival times as follows • J4 = J5 = (2; 2; 4), and • J4 = J 5 = (4; 4; 8).

  19. Example Part 1 • J1 = J2 = (0, 2, 4); J3 = (0, 4, 8) • Later arrival times as follows • J4 = J5 = (2, 2, 4), and • J4‘ = J 5‘ = (4, 4, 8). J3 cannot execute in interval [0,2] J1 J2 J3 J4 J5 14 18 16 8 0 6 12 4 10 2

  20. Example Part 2 • J1 = J2 = (0, 2, 4); J3 = (0, 4, 8) • Later arrival times as follows • J4 = J5 = (2, 2, 4), and • J4‘ = J 5‘ = (4, 4, 8). J3 must execute in interval [0,2] J1 J2 J3 J4 J5 14 18 16 8 0 6 12 4 10 2

  21. Multiprocessor Scheduling of PTs • There are optimal online algorithms for scheduling periodic tasks on multiprocessors • Pfair, LLREF, DP-Wrap • These tasks make decisions to emulate the ideal schedule

  22. Ideal (but impractical) schedule • Ideally, we would execute all tasks at a constant rate • Example T1 = (2,4), T2 = (3,6), and T3 = (6,8) Proportion Processor per Task T1 Remaining Execution 2 2 T1 1 T2 T3 0 4 8 12 • Unfortunately, there are only 2 processors and each can execute only one task at a time!

  23. Optimal Algorithms for Multiprocs • All the optimal scheduling algorithms tracks the ideal schedule • Tasks are guaranteed to have executed at ideal rate whenever they have a deadline • Hence, all deadlines are met! T1 Remaining Execution Actual and Ideal 2 1 0 4 8 12 CSCI 8740

  24. DP-Fair Scheduling • A global scheduling algorithm for periodic tasks with deadlines equal to periods • The global scheduler executes whenever a job arrives / a deadline occurs • The intervals between scheduling events is called a time slice • At the beginning of each slice of length L, the scheduler allocates uiL units of execution to each task Ti • Every DP-Fair Scheduling algorithm must adhere to 3 “don’t be stupid” rules

  25. Don’t Be Stupid Rules • Rule 1: Execute any job with zero laxity • Execute right away if at risk of missing a deadline • Rule 2: Don’t execute any job with zero remaining execution time • Don’t execute if execution time is completed • Rule 3: Do not allow processors to idle for more than L(m – U) time units • Do not idle more than system slack allows

  26. DP-Wrap: A Simple DP-Fair Alg • T1=(7,2), T2= (10,3), T3= (9,4), T4 = (12,7), T5 = (14,5) • First time slice is [0,7) • Execution times are 2, 2.1, 3.1, 4.1 and 2.5, resp. T1 T2 T3 T4 T5 T1 T2 T3 T4 T5

  27. Extensions to the DP-Fair Rules • DP-Fair can also be used with sporadic tasks and tasks with deadlines not equal to periods • If deadlines are ≥ periods, DP-Fair algorithms are still optimal • If deadlines are < periods optimality no longer holds

  28. Other types of real-time systems • Soft real-time systems • Deadlines may be missed • Mixed real-time and non-real-time sytems • Real-time and non-real-time jobs executing in the same system • Want non-real-time jobs to complete as early as possible without causing real-time jobs to miss deadlines

  29. Why I like researching real-time systems • Analyzing real-time systems is like solving puzzles • Analysis is visual • Small changes in assumptions can have large impact in analysis

More Related