Real-Time Operating Systems
An RTOS provides bounded, predictable scheduling and services so that timing guarantees, not just average performance, can be proven.
What Makes an OS Real-Time
A real-time operating system is not simply a fast operating system. Its defining features are bounded latencies for its own operations: a known worst-case interrupt latency, a known worst-case scheduling latency, and predictable behavior for locks, timers, and context switches. A general-purpose OS optimizes throughput and fairness and permits unbounded pauses; an RTOS sacrifices some average performance to guarantee upper bounds.
Core Services
- Priority-based preemptive scheduling with a bounded number of priority levels
- Deterministic inter-task communication: queues, semaphores, mailboxes
- High-resolution timers driving periodic tasks
- Bounded interrupt-to-task handoff
- Mechanisms to bound priority inversion
Kernel Design for Predictability
RTOS kernels keep critical sections short and bounded so that the maximum time interrupts are disabled is small and known. They avoid algorithms whose cost depends on the number of tasks in an unbounded way; ready-queue operations are typically constant time. Memory is often statically allocated to remove the unpredictability of dynamic allocation. These choices make the worst case analyzable.
The Real-Time Spectrum
Options range from small dedicated microkernels running on microcontrollers, through real-time patches that give a general-purpose kernel bounded preemption latency, to partitioned hypervisors that run a hard real-time domain beside a general-purpose one. The right choice depends on how tight the deadlines are and how much other software must coexist.
Using an RTOS Correctly
An RTOS enables timing guarantees but does not create them. The engineer still assigns priorities according to a sound policy such as rate-monotonic analysis, keeps the critical path free of blocking calls, avoids unbounded loops, and validates the assumed worst-case execution times. The operating system supplies bounded primitives; the application must be built so that the composed system provably meets its deadlines.