Syllabus 9.6 — Real-Time Aspects: Determinism, Scheduling, Latency & Embedded Systems
1. What is a Real-Time System?
A Real-Time System is a computing system where correctness depends on both the logical result and the time at which the result is produced.
| Outcome | Result |
| Correct Answer + Delivered on Time | ✅ Success |
| Correct Answer + Delivered Late | ❌ Failure |
Airbag Example: Airbag must deploy within 20 ms after crash detection.
| Deployment Time | Outcome |
| 15 ms | ✅ Success |
| 18 ms | ✅ Success |
| 25 ms | ❌ Failure — too late |
An RTOS is an operating system specifically designed to process events and respond within guaranteed timing constraints.
General OS vs RTOS
| Feature | General OS | RTOS |
| Primary goal | Speed and throughput | Predictability |
| Performance measure | Average performance | Guaranteed response time |
| Deadlines | May be missed | Must be met |
| Kernel size | Feature-rich, large | Small, minimal |
| Use case | General computing | Mission-critical applications |
2. Characteristics of RTOS
| Characteristic | Definition | Example |
| Determinism |
Operations complete within a known and predictable time every time |
Interrupt handling always takes exactly 5 ms — not sometimes 2 ms, sometimes 50 ms |
| Fast Response Time |
System responds immediately to events |
Medical monitor, airbag, industrial robot |
| Reliability |
System failures are unacceptable |
Nuclear plant control, aircraft navigation |
| High Availability |
System operates continuously with minimal downtime |
Power grid, air traffic control |
| Minimal Latency |
Delay between event and response must be extremely small |
Sensor activation to actuator response |
📌 Determinism is the heart of RTOS. Memory Trick — DRILL: D → Deterministic R → Reliable I → Interrupt responsive L → Low latency L → Low jitter
3. Key RTOS Concepts
Deadline
A deadline is the maximum allowable time to complete a task.
| Example | Deadline |
| Emergency braking system | 10 ms |
| Airbag deployment | 20 ms |
| Pacemaker pulse | Specific cardiac interval |
Latency
Latency is the delay between an event occurring and the system beginning its response.
| Latency Type | Definition |
| Interrupt Latency | Time from interrupt occurrence to start of Interrupt Service Routine (ISR) execution |
| Scheduling Latency | Time between a task becoming ready and the scheduler assigning the CPU |
| Dispatch Latency | Time required to switch the CPU from one process to another (context switch time) |
Jitter
Jitter is the variation in response time. RTOS aims to minimize jitter.
| Good RTOS | Poor RTOS |
| 10 ms, 10 ms, 11 ms, 10 ms — very consistent | 10 ms, 30 ms, 9 ms, 50 ms — unpredictable |
| Low jitter ✅ | High jitter ❌ |
4. Types of Real-Time Systems
A. Hard Real-Time System
Missing even one deadline is catastrophic and unacceptable.
| Aspect | Detail |
| Deadline tolerance | Zero — no missed deadlines |
| Consequence of missing | Catastrophic failure (injury, death, disaster) |
| Determinism | Highest |
| Examples | Aircraft flight control, airbag, nuclear reactor, pacemaker |
B. Soft Real-Time System
Missing a deadline reduces quality or performance but does not cause system failure.
| Aspect | Detail |
| Deadline tolerance | Some misses acceptable |
| Consequence of missing | Reduced quality (e.g., video frames dropped) |
| Examples | Video streaming, online gaming, audio playback, video conferencing |
C. Firm Real-Time System
A result produced after its deadline has no value, but occasional missed deadlines are tolerated.
| Aspect | Detail |
| Deadline tolerance | Occasional misses tolerated |
| Late result value | Zero — useless if late |
| Examples | Stock market data feed, radar tracking, industrial monitoring |
Comparison Table
| Feature | Hard RT | Firm RT | Soft RT |
| Missed deadlines | Never allowed | Occasional — but result useless | Acceptable with degraded quality |
| Consequence | Catastrophic failure | Reduced usefulness | Reduced performance |
| Strictness | Strictest | Moderate | Least strict |
| Example | Airbag, pacemaker | Radar, stock ticker | Netflix, online gaming |
📌 Memory Trick — HFS (Hardest → Softest): H → Hard | F → Firm | S → Soft
5. Embedded Systems
RTOS is widely used in embedded systems — computers designed to perform a dedicated function within a larger device.
| Category | Examples |
| Home Appliances | Microwave oven, washing machine, printer |
| Wearables | Smartwatch, fitness tracker |
| Automotive | Car ECU (Engine Control Unit), ABS braking |
| Medical | Pacemaker, insulin pump |
| Characteristic | Detail |
| Size | Small form factor |
| Purpose | Single dedicated function |
| Power | Low power consumption |
| Efficiency | Highly optimized for its task |
6. RTOS Scheduling
RTOS scheduling focuses on meeting deadlines, not just maximizing throughput.
A. Rate Monotonic Scheduling (RMS)
Principle: Tasks with shorter periods receive higher priority. Priority is fixed and never changes.
| Task | Period | Priority |
| T1 | 20 ms | Highest (shortest period) |
| T2 | 50 ms | Medium |
| T3 | 100 ms | Lowest (longest period) |
| Characteristic | Detail |
| Priority type | Fixed (does not change at runtime) |
| Suitable for | Periodic tasks |
| Advantages | Simple, predictable, widely used |
B. Earliest Deadline First (EDF)
Principle: The task with the nearest (earliest) deadline always executes first. Priority is dynamic and changes continuously.
| Task | Deadline | Execution Order |
| A | 20 ms | 1st |
| B | 40 ms | 2nd |
| C | 80 ms | 3rd |
| Characteristic | Detail |
| Priority type | Dynamic (recalculated as deadlines change) |
| CPU utilization | Higher than RMS |
| Advantages | More flexible, better CPU utilization |
RMS vs EDF
| Feature | RMS | EDF |
| Priority | Fixed (based on period) | Dynamic (based on deadline) |
| Basis | Task period | Task deadline |
| Complexity | Simpler | More complex |
| CPU utilization | Up to ~69% theoretical max | Up to 100% theoretical max |
| Best for | Fixed periodic tasks | Mixed / dynamic workloads |
📌 Memory Trick — RE: R → RMS (fixed, period-based) | E → EDF (dynamic, deadline-based)
7. Interrupt Handling in RTOS
Interrupts must be handled as quickly as possible to maintain real-time guarantees.
| Step | Action |
| 1 | Interrupt occurs (sensor, timer, device) |
| 2 | CPU saves current task state |
| 3 | Interrupt Service Routine (ISR) executes |
| 4 | Normal execution resumes |
Goal: Keep interrupt latency as low and as consistent as possible.
| ISR Characteristic | Detail |
| Length | Short — does minimal work, defers the rest |
| Execution | Fast — high priority execution |
| Examples | Keyboard press, sensor activation, timer expiration |
8. Applications of RTOS
| Domain | Examples |
| Aerospace | Aircraft navigation, flight control, satellite systems |
| Automotive | ABS braking, airbag, cruise control, Engine Control Unit (ECU) |
| Medical | Pacemakers, MRI, ventilators, patient monitoring |
| Industrial Automation | Robots, CNC machines, factory automation |
| Telecommunications | Mobile base stations, network switches |
| Defense | Missile guidance, radar systems |
9 & 10. Advantages and Disadvantages
| Advantages of RTOS | Disadvantages of RTOS |
| Predictable, deterministic behavior | Complex design and development |
| High reliability and availability | Higher development cost |
| Fast response and low latency | Limited flexibility compared to GPOS |
| Supports mission-critical applications | May require specialized hardware |
| Minimal jitter | Smaller ecosystem of tools and libraries |
11. RTOS vs General Purpose Operating System (GPOS)
| Feature | RTOS | General Purpose OS |
| Scheduling goal | Deterministic — meet deadlines | Best effort — maximize throughput |
| Focus | Deadline-oriented | User-oriented |
| Latency | Very low, consistent | Moderate, variable |
| Use case | Mission-critical systems | General computing (office, gaming) |
| Kernel | Small, minimal | Feature-rich, large |
| Examples | FreeRTOS, VxWorks, QNX | Windows, Linux, macOS |
12. Popular RTOS Examples
| RTOS | Common Use |
| FreeRTOS | Embedded systems, IoT devices |
| VxWorks | Aerospace & defense (used in Mars rovers) |
| QNX | Automotive (used in car infotainment) |
| RTLinux | Industrial control |
| Zephyr | IoT devices |
| RTEMS | NASA & space applications |
Memory Tricks
| Mnemonic | Full Form |
| Types of RT Systems — HFS |
H → Hard (strictest) F → Firm S → Soft (least strict) |
| Scheduling — RE |
R → RMS (fixed, period) E → EDF (dynamic, deadline) |
| RTOS Features — DRILL |
D → Deterministic
R → Reliable
I → Interrupt responsive
L → Low latency
L → Low jitter
|
Frequently Asked Exam Questions
| Question | Answer |
| What is an RTOS? | An OS designed to produce correct results within guaranteed timing constraints |
| Most important characteristic of RTOS? | Determinism — predictable timing behavior |
| Hard vs Soft Real-Time? | Hard: no missed deadlines (catastrophic if missed). Soft: occasional misses reduce quality. |
| What is latency? | Delay between an event and the system's response |
| What is jitter? | Variation in response time |
| Difference between RMS and EDF? | RMS: fixed priority by period. EDF: dynamic priority by nearest deadline. |
| What is an embedded system? | A computer designed to perform a dedicated function within a larger device |
| Give three RTOS applications. | Airbag system, pacemaker, aircraft flight control |
Practice MCQs
-
1. Which characteristic is most important in an RTOS?
A. High storage capacity B. Determinism C. Large GUI D. High-resolution graphics
✅ Answer: B — Determinism
-
2. Missing a deadline is unacceptable in:
A. Soft Real-Time System B. Hard Real-Time System C. Time-Sharing System D. Batch System
✅ Answer: B — Hard Real-Time System
-
3. Which scheduling algorithm gives higher priority to tasks with shorter periods?
A. FCFS B. EDF C. RMS D. Round Robin
✅ Answer: C — RMS (Rate Monotonic Scheduling)
-
4. Which scheduling algorithm always selects the task with the closest deadline?
A. Priority Scheduling B. RMS C. EDF D. FCFS
✅ Answer: C — EDF (Earliest Deadline First)
-
5. Which of the following is a common application of RTOS?
A. Word processing B. Air traffic control C. Movie editing D. Spreadsheet software
✅ Answer: B — Air traffic control