Back to Home

Starvation & Priority Inversion

Watch low-priority threads wait forever while high-priority ones dominate

😫 What is Starvation?

Starvation occurs when a thread is perpetually denied access to resources because higher-priority threads keep cutting in line. The thread is technically ready to run but never gets a chance.

⚠️ Causes

  • • Unfair scheduling policies
  • • Priority inversion
  • • High-priority threads hogging resources
  • • Writers always yielding to readers

✓ Solutions

  • Aging: Boost priority over time
  • Fair locks: FIFO ordering
  • Priority inheritance
  • Time slicing: Limit hold time

🎬 What to Watch

In unfair mode, low-priority threads starve and turn red. In fair mode, wait-time boosts priority so everyone gets a turn!

Tick
0
Lock Holder
None
Starving
0
Scheduling
Unfair

Thread Queue

Event Log

Start demo to see events...

What's Happening

Unfair: High priority threads always get the lock first.

Low priority threads keep waiting... and waiting... never getting a chance.

This is starvation!

Solutions

  • Aging: Boost priority over time
  • Fair locks: FIFO ordering
  • Priority inheritance: Prevent inversion
  • Time slicing: Limit execution time