Download presentation
Presentation is loading. Please wait.
Published byCatherine Wood Modified over 9 years ago
1
Real-Time Systems Mark Stanovich
2
Introduction System with timing constraints (e.g., deadlines) What makes a real-time system different? – Meeting timing constraints is critical Same as incorrect function output – 1 + 1 = 3? May also need to meet other constraints at the same time (e.g. power)
3
Examples Airplanes Cars Movie players Robots Radar Tracking Cell phones
4
Difficulties What are some difficulties producing real-time systems?
5
Difficulties What are some difficulties producing real-time systems? – Abstractions hide timing characteristics Virtual memory Virtual machines Caching Layering of software functionalities – Optimal solutions tend to be NP-complete or harder (or may not exist)
6
Real-Time Scheduling Guarantee that timing constraints will always be met
7
Real-Time Scheduling Theory Analysis techniques to design a system to meet timing constraints Schedulability Analysis – Workload models – Processor models – Scheduling algorithms
8
time Period = T Computation time WCET = C Deadline = D Task jobs (j 1, j 2, j 3, …) Release Time 8 Task = {T, C, D} Periodic Task
9
Processor Model (Theory) Number of processors 9
10
Processor Model (Theory) Number of processors Preemptable or non-preemptable j1j1 j2j2 j1j1 j2j2 arrivals time 10
11
Processor Model (Theory) Number of processors Preemptable or non-preemptable Processor executes at a fixed or variable speed time 11
12
Scheduling Algorithm (Theory) Arbitrate access to shared resources Video Phone GPS Navigation Movie Player ? 12
13
Real-Time Scheduling Theory Fixed-task priority – Priority assigned to jobs of a single task does not change – Rate-monotonic Fixed-job priority – Priority assigned to different jobs of a single task may change – Earliest deadline first (EDF) Dynamic-job priority – Priority of a single job may change – P-fair
14
Real-Time Scheduling Theory What is the time complexity for non- preemptive scheduling?
15
Non-preemptive Scheduling time 15
16
Anomalies Do all jobs of a task have equal execution times? Considering all job sizes less than the WCET is impractical? Resctrict models to be free of anomalies – System is predictable – Non-preemptive EDF scheduling is not predictable
17
Real-Time Scheduling Theory Guarantee jobs will meet their deadlines Examples – Response time analysis Compute max response time of each task Verify this is ≤ deadline – Utilization bounds Prove job can miss deadline only if total utilization > utilization bound Verify total utilization ≤ utilization bound – EDF utilization bound = 1 – RM utilization bound = ln(2)
18
Applications OS Hardware Storage Device Storage Device Driver CPU Scheduler I/O Scheduler Network DD Implications for OS 18 App
19
Implications for OS Theoretical guarantees rely on implementation matching the theory OS must provide mechanisms that allow accurate implementation of the theory Example: – How can we use common OS abstractions to implement a periodic task?
20
Periodic Task sched_setscheduler() clock_nanosleep()
21
Difficulties What are some other difficulties in an implemented OS that would cause problems for a real-time system?
22
Difficulties What are some other difficulties in an implemented OS that would cause problems for a real-time system? – Critical sections – Hierarchical scheduling spaces Interrupt handlers – Scheduling tasks Wake-up latency – Shared OS components Network device driver File system metadata
23
Priority Inversion Lower priority job is executing while a higher priority job is pending but not executing – Critical sections should be short – Blocking terms must be added to schedulability analysis
24
Priority Inheritance If task A is block by task B, task B inherits task A's priority – Implementation complexity can be high Transitive inheritance Multiprocessor scheduling POSIX support for pthread_mutex_t using PTHREAD_PRIO_INHERIT
25
Priority Inversion Varying CPU time priority – Interrupts – Soft IRQs Adhoc changes in priority Difficult to model CPU time at a given priority
26
Extracting Worst-Case Behavior Schedulability analysis requires worst-case service time – Vary between devices – Unpredictable – Rarely observed e.g., Hard drive
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.