← Lessons

quiz vs the machine

Platinum1860

Concurrency

The Priority Inheritance Protocol

Temporarily boosting a lock holder so a high priority thread is not blocked by a lower one.

5 min read · advanced · beat Platinum to climb

The inversion problem

In a priority scheduler, a high priority thread should run before low priority ones. But if a low priority thread holds a lock the high priority thread needs, the high priority thread must wait. Worse, a medium priority thread can preempt the low holder, delaying it further. This is priority inversion, and it can stall the urgent thread indefinitely.

How inheritance fixes it

The priority inheritance protocol raises the holder temporarily.

  • When a high priority thread blocks on a lock, the holder inherits the high priority.
  • The boosted holder now cannot be preempted by medium threads, so it finishes the critical section quickly.
  • On releasing the lock, the holder drops back to its original priority.

The boost lasts only as long as the holder owns the contended lock, and it propagates along chains of locks if needed.

Key idea

Priority inheritance temporarily lifts a lock holder to the priority of the highest thread waiting on it, so medium threads cannot preempt the holder and the urgent thread gets the lock without unbounded inversion.

Check yourself

Answer to earn rating on the learn ladder.

1. What is priority inversion?

2. How does priority inheritance respond when a high priority thread blocks on a lock?

3. When does the boosted holder return to its original priority?