AdvancedTopic 80 of 104Electronics & Embedded
Priority inversion
A low-priority task blocks a high-priority one; solved by priority inheritance.
In depth
A high-priority task blocks on a mutex held by a low-priority task that is pre-empted by a medium-priority one, delaying the high task unboundedly. Priority inheritance or ceiling protocols fix it. Famous in the 1997 Mars Pathfinder resets.
Key points
- Use mutexes with inheritance
- Keep critical sections short
- Analyse blocking time
ExamplePathfinder's resets were solved by enabling priority inheritance remotely.
What is Priority inversion?
A low-priority task blocks a high-priority one; solved by priority inheritance.
Why is it important to understand priority inversion?
Priority inversion can make a high-priority task wait for a low-priority task, which has caused real failures in space and robotics systems.
What is priority inversion?
When a high-priority task is blocked by a low-priority task holding a resource, while medium-priority tasks run and delay the release.
How is it solved?
Priority inheritance temporarily raises the low-priority task's priority while it holds the resource, so it finishes quickly.
How is Priority inversion used in practice?
Typical applications include explaining the reset of a spacecraft caused by a blocked high-priority task, using priority inheritance on a mutex in an RTOS and designing a shared bus so a low-priority logger cannot block a control task.
What should I learn before Priority inversion?
Study "Mutexes and semaphores" first (topic 79 of 104 in Electronics & Embedded). It covers the groundwork this topic builds on.
What are the key points of Priority inversion?
Use mutexes with inheritance. Keep critical sections short. Analyse blocking time.
Can you give an example of Priority inversion?
Pathfinder's resets were solved by enabling priority inheritance remotely.
What comes after Priority inversion?
The next topic is "Sensors", which builds directly on this one.
How difficult is Priority inversion?
It is classed as Advanced in Electronics & Embedded (topic 80 of 104). It is an advanced topic. It assumes you are comfortable with the intermediate topics in Electronics & Embedded.