Priority Inversion and Aging
You'll learn how priority scheduling can accidentally starve low-priority processes, and how aging fixes this by gradually boosting their priority over time.
The Starvation Problem
In priority scheduling, the CPU always runs the highest-priority process first. Sounds fair, right? But here's the catch: if high-priority processes keep arriving, low-priority processes may never get CPU time. They sit in the ready queue indefinitely, waiting forever—a problem called starvation.
Analogy: Imagine an emergency room where critical patients (high priority) are always treated first. If emergencies keep arriving non-stop, someone with a minor injury might wait for days, even though their issue deserves eventual care.
What is Aging?
Aging is a simple, elegant solution: the longer a process waits in the ready queue, the more we gradually increase its priority. Eventually, even the lowest-priority process becomes high enough to get scheduled.
For example:
- A process starts at priority 5 (low)
- Every 10 minutes it waits, we boost its priority by 1
- After 50 minutes: priority becomes 10 (high enough to run)
This ensures fairness—every process eventually gets CPU time, preventing indefinite starvation.
Priority Inversion (Brief Context)
Priority inversion is a related but different problem: a high-priority process waits for a resource held by a low-priority process, while a medium-priority process runs, delaying everyone. Aging doesn't solve this directly, but understanding both helps you see the complexities of priority-based scheduling.
Key Takeaway: Aging prevents starvation in priority scheduling by gradually increasing the priority of waiting processes, ensuring all processes eventually receive CPU time regardless of their initial priority.