Operating Systems and Embedded Software · Operating system
Real-Time Operating SystemRTOS
Also known as real-time OS, real-time kernel
An operating system designed so that tasks complete within known, bounded time limits. It favours predictable (deterministic) response over average throughput, typically through priority-based preemptive scheduling.
Explanation
In a real-time system, a correct result delivered after its deadline counts as a failure. An RTOS therefore provides scheduling and kernel services with bounded, analysable latency: when a high-priority task becomes ready, it preempts lower-priority work within a predictable time. Real-time means meeting timing constraints, not necessarily running fast.
RTOSs range from small microcontroller kernels such as Zephyr to POSIX systems such as QNX. Zephyr, for example, offers priority-based scheduling with cooperative and preemptible threads, optional time slicing and earliest-deadline-first ordering. On hardware with memory protection it also runs threads in user mode, isolated from each other and from the kernel.
General-purpose operating systems can approach real-time behaviour, for example Linux with PREEMPT_RT, but a hard guarantee always depends on the whole system: worst-case execution times, interrupt load, memory and bus contention, and correct priority assignment. POSIX requires only 32 distinct real-time priority levels, so portability of priority schemes should be checked.
How it works
Each task has a priority and sometimes a deadline. The scheduler always runs the highest-priority ready task and switches as soon as a more urgent task becomes ready, for example when an interrupt releases a waiting task. Mutexes often use priority inheritance to bound blocking. Designers then verify schedulability, checking that every task meets its deadline in the worst case.
Automotive applications
- Engine, brake and chassis control on microcontrollers
- Sensor front-end processing with fixed sample periods
- Safety monitors on a lockstep safety island
- Instrument clusters needing guaranteed display update rates
Example
A brake ECU runs a 1 ms control task at the highest priority and a 10 ms diagnostics task at low priority. When the 1 ms timer interrupt fires, the RTOS preempts the diagnostics task immediately, keeping the control loop's start-time jitter within its specified bound.
An illustrative example: any figures in it are worked numbers, not measurements.
References
- Zephyr Project Documentation: Introduction (opens in a new tab)
“Zephyr is an open source real-time operating system (RTOS) for embedded devices.”
- sched(7): overview of CPU scheduling (opens in a new tab)
Definitions are original summaries. Standards text is not reproduced; follow the links for the official publications.