Priority inversion can occur as follows:
- A low-priority task acquires a lock.
- This low-priority task is preempted by a medium-priority task.
- A high-priority task attempts to acquire the lock held by the preempted low-priority task.
The high-priority task cannot run until the low-priority task releases the lock, which will not happen as long as the medium priority task continues to run. The medium-priority task is thus effectively preventing the high-priority task from running, hence the name "priority inversion". Priority inversion can be prevented via priority inheritance, by disabling preemption for any task holding a lock, by associating a priority with each lock (boosting any holding task to the lock's priority, which must be at least as high as any task acquiring it) or by prohibiting tasks of different priorities from acquiring the same lock.
CONFIG_PREEMPT_RT uses priority inheritance.