Embedded Systems & Firmware

In a preemptive RTOS, while a low-priority task is running, a high-priority task receives the data it was waiting for and becomes ready. What generally happens?

  1. AThe high-priority task waits until the low-priority task finishes on its own
  2. BBoth tasks stop and the microcontroller reboots
  3. CThe low-priority task is suspended midway and the high-priority task runs immediately
Show answer and explanation

Answer: C. The low-priority task is suspended midway and the high-priority task runs immediately

In a preemptive RTOS, when an interrupt or similar event makes a higher-priority task ready, the kernel saves and suspends the running low-priority task and switches to the high-priority one. When the high-priority task finishes or blocks, the low-priority task resumes where it left off. This keeps response times for high-priority work short and predictable.

  • A. That is cooperative (non-preemptive) switching.
  • B. There is no reboot.
  • C. Correct. This is preemption.
Practice this topic Back to topic

More Embedded Systems & Firmware questions

  1. Which describes priority inversion in an RTOS?
  2. Which describes priority inheritance, used to prevent priority inversion?
  3. In an RTOS, what is the advantage of using a queue (message queue) to pass data from a sensor-reading task to a display task?
  4. What is the difference between hard real-time and soft real-time?
  5. Why is it bad practice to kick (reset) the watchdog timer unconditionally inside a 1 ms timer interrupt handler?