What is Priority inheritance?
Temporarily raising a low-priority task holding a resource to the priority of the high-priority task waiting for it, preventing priority inversion.
Japanese name: 優先度継承
Temporarily raising a low-priority task holding a resource to the priority of the high-priority task waiting for it, preventing priority inversion.
Japanese name: 優先度継承
While low-priority task L holds a mutex and high-priority task H waits for it, the operating system temporarily raises the priority of L to that of H. Medium-priority task M can then no longer preempt L, so L finishes sooner and releases the mutex. On release L drops back to its own priority and H runs.
It prevents H from waiting indefinitely because of unrelated medium-priority tasks, that is, unbounded priority inversion. H still waits for the time L needs to finish with the resource. With nested mutexes the waiting can chain and grow, and deadlock is not prevented. To limit these too, the priority ceiling protocol gives each mutex a ceiling equal to the highest priority of any task that uses it and raises the holder to that ceiling as soon as it locks the mutex.
Priority inheritance belongs to mutexes, which have an owner. In FreeRTOS, mutexes have priority inheritance and binary semaphores do not. With POSIX threads it is selected with the mutex attribute PTHREAD_PRIO_INHERIT. On Mars Pathfinder, enabling priority inheritance on a VxWorks mutex cured the repeated resets.
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's wait is then roughly bounded by the time the low task uses the resource, although nested mutexes can chain the waits and make them longer. Many RTOS mutexes provide this feature.
Generally not. A semaphore has no owner, so the operating system cannot tell whose priority to raise. Use a mutex to protect a shared resource.
No. The waiting task still waits until the holder is done. Keep the section that holds the resource short, and do not do slow work or block on something else inside it.
Building real circuits is a good way to check what you learned in the questions.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.