EMBEDDED SYSTEMS & MICROCONTROLLERS · PAGE 36
Real-Time Operating System Basics
Running several tasks at once.
An RTOS is a small scheduler that switches between tasks. Each task has its own stack and priority, and higher-priority tasks run first.
Tasks communicate through queues and semaphores rather than shared globals. This avoids many timing bugs but uses extra RAM and flash.
For simple devices, a state machine in one loop is often enough.