Real-Time Operating Systems
An RTOS runs multiple tasks with priorities and guaranteed timing on a microcontroller.
Advanced
An RTOS like FreeRTOS or Zephyr provides:
- tasks (threads) with priorities and a preemptive scheduler,
- queues for passing data between tasks,
- semaphores and mutexes for synchronisation,
- software timers.
void blink_task(void *arg) {
for (;;) {
gpio_toggle(LED);
vTaskDelay(pdMS_TO_TICKS(500));
}
}
xTaskCreate(blink_task, "blink", 128, NULL, 1, NULL);
vTaskStartScheduler();
"Real-time" means deterministic — a high-priority task always runs within a known time — not necessarily "fast". Watch for priority inversion, solved by priority-inheritance mutexes.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.