What is the difference between a general-purpose OS and a real-time OS (RTOS)?
A general-purpose OS (like Linux or Windows) is designed to maximize throughput — it tries to get as much total work done as possible, sharing CPU time fairly among all processes. An RTOS, on the other hand, is designed for determinism — it guarantees that the highest-priority ready task always runs within a bounded, predictable time.
The key distinction is not speed but predictability. An RTOS kernel is typically fully preemptible: if a higher-priority task becomes ready while a lower-priority task is running, the scheduler immediately context-switches to the higher-priority task. In a general-purpose OS, the scheduler may delay preemption to finish a kernel operation or to give the current process its remaining time slice.
In embedded systems this matters because missing a deadline can cause physical harm — a motor controller that reacts 5 ms late could damage hardware, or an airbag that deploys 50 ms late is useless. Common RTOS examples include FreeRTOS, Zephyr, VxWorks, and QNX. Many embedded projects that do not need hard real-time guarantees still use an RTOS simply because the priority-based preemptive scheduler makes system behavior easier to reason about than bare-metal super-loops.
Source: Operating Systems & RTOS Q&A
