Embedded Systems & Firmware
Which describes priority inheritance, used to prevent priority inversion?
- ALower the high-priority task to the low task's priority
- BGive all tasks the same priority
- CTemporarily raise the low-priority task holding a resource to the priority of the high-priority task waiting for it
Show answer and explanation
Answer: C. Temporarily raise the low-priority task holding a resource to the priority of the high-priority task waiting for it
With priority inheritance, when a high-priority task starts waiting for a mutex held by a low-priority task, the low task temporarily gets the high task's priority. It then proceeds without being preempted by medium tasks and returns to its original priority on releasing the resource. The high task waits only for the short time the low task uses the resource. Many RTOS mutexes provide this feature.
- A. That would delay the high task even more.
- B. Priority would lose its meaning.
- C. Correct. It can release the resource without being preempted by medium tasks.