Home / Learn Chip Programming / What Is an RTOS and When Do You Need One
What Is an RTOS and When Do You Need One
An RTOS runs multiple tasks with deterministic timing. Know the difference from a plain loop.
Theory in plain words
What it is
A real-time operating system schedules tasks by priority, offers queues, semaphores, mutexes and timers, and guarantees bounded latency. FreeRTOS, Zephyr, ThreadX (Azure RTOS), RT-Thread and embOS are common.
Why we use it
Super-loops become unmanageable with many activities. An RTOS gives structure, but costs RAM, flash and requires care with shared data.
How it works
Split the system into tasks: sensor task, display task, communication task. The kernel switches between them using a timer tick and context switches.
Where it is used
- Anything with several activities and timing constraints
- Wi-Fi/BLE products
- Safety-critical systems
Super loop latency
In a super loop the worst response time is the sum of all work. With pre-emptive priorities it is only the context switch time.
| RTOS | Licence | Footprint | Where |
|---|---|---|---|
| FreeRTOS | MIT | 6 to 10 KB flash | AWS, ESP32, STM32, most MCUs |
| Zephyr | Apache 2.0 | 8+ KB, full platform | Linux Foundation, Nordic, Intel |
| Azure RTOS ThreadX / Eclipse ThreadX | MIT (open) | small | consumer, industrial |
| RT-Thread | Apache 2.0 | small | China, many boards |
| SafeRTOS / QNX / VxWorks | commercial | certified | automotive, aerospace, medical |
Quick quiz
1. Biggest benefit of RTOS priorities?
Latency of important tasks stays low.
2. Which RTOS is MIT licensed and very popular?
Widely used on MCUs.
Common questions
Biggest benefit of RTOS priorities?
Urgent tasks pre-empt less urgent ones. Latency of important tasks stays low.
Which RTOS is MIT licensed and very popular?
FreeRTOS. Widely used on MCUs.