Priority inversion: a high priority task is indirectly preempted by a medium priority task. (a medium priority task preempts a low priority task, the low priority task is using a shared resource on which the high priority task is pending). The process from wiki is:
- There are 3 tasks A, B, and C, with priority from high to low. A and C share the resource
- C successfully locks the resource
- A attempts to acquire resource, being blocked and wait for C to release resource
- B became runnable before C release resource
- Now you don't know when C can release resource, and A is still blocked
- reversion happens: B is running and A is not
Solution 2: Priority ceiling - each resource is assigned a priority ceiling, which equals to the highest priority of an task which may lock the resource. Once a task finishes with the resource, its priority returns to normal.
The link is a good read for this topic.