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