Starvation and Aging in Scheduling

Starvation in scheduling is when a process is endlessly passed over by newer or higher-priority arrivals, as can happen to long jobs under SJF or SRTF and to low-priority jobs under priority scheduling. Aging fixes it by gradually raising a waiting process's priority the longer it waits, so it eventually gets the CPU.

4 min read

This topic covers starvation and its standard fix, aging, specifically as they apply within CPU scheduling algorithms (a related, more general starvation concept, covering resources beyond just CPU time, is covered separately). Any scheduling algorithm that favors some processes over others based on a changeable criterion, shortest job first, or highest priority, carries a real risk that some process ends up perpetually passed over.

Where starvation shows up in scheduling specifically

In SJF/SRTF: a long process can wait indefinitely if shorter jobs keep continuously arriving, since the algorithm always prefers whatever's shortest right now, with no regard for how long anything has already been waiting.

In priority scheduling: a low-priority process can wait indefinitely if higher-priority processes keep continuously arriving, for exactly the same underlying reason, the algorithm's own selection criterion (priority) never on its own accounts for wait time.

Aging as the fix

Aging directly addresses this by making wait time itself part of the selection criterion. The longer a process has been waiting, the more its effective priority (or effective "shortness," in an SJF-style system) increases, until it eventually becomes favorable enough to get selected regardless of what else is currently in the queue.

A worked example

A priority scheduler where a lower number means higher priority, and aging reduces a waiting process's effective priority number by 1 for every 5 units of time it waits.

Process P1 arrives with priority 8 (low). Without aging, if higher-priority processes (priority 1 through 5) keep arriving continuously, P1 could wait forever, always beaten out. With aging: after waiting 5 units, P1's effective priority becomes 7. After 10 units, 6. After 15 units, 5, now tied with some of the "naturally" higher-priority arrivals. After enough waiting, P1's effective priority eventually becomes low enough (meaning high enough real priority) that it wins out over whatever else is currently ready, guaranteeing it does eventually run, no matter how many other processes kept arriving.

Why this matters beyond the exam question

Any system that makes selection decisions based purely on some property of the candidates themselves (shortest, highest priority) without also considering how long each candidate has already been waiting, is structurally vulnerable to this exact starvation pattern. This isn't unique to CPU scheduling either, the same idea applies to any resource-allocation or task-selection system: job queues, request-handling systems, even non-CPU contexts like a customer support ticket queue that only ever pulls the "highest severity" ticket next, risking a low-severity ticket that's been open for months while urgent tickets keep arriving.

Where this matters in real systems

Production schedulers that use priority as a factor at all (which is most of them, in some form) build in an aging-like mechanism specifically to guarantee this can't happen. Linux's scheduler, for instance, dynamically adjusts a process's effective priority based partly on how much it's actually been waiting versus running, which is functionally the same fairness guarantee aging provides, just implemented as part of a broader fairness-tracking mechanism rather than a standalone bolt-on rule.

What interviewers actually ask about starvation and aging in scheduling

  • "How can starvation occur in SJF, specifically?" If shorter processes keep continuously arriving, a longer process can be perpetually deprioritized and wait indefinitely, since SJF always favors whatever's currently shortest with no regard for existing wait time.
  • "What is aging, precisely?" Gradually increasing a waiting process's effective priority (or effective selection-worthiness) the longer it waits, guaranteeing it eventually becomes favorable enough to be selected.
  • "Does aging change a process's real, declared priority, or just how it's treated by the scheduler?" Only its effective priority for scheduling purposes; the process's originally assigned priority value itself typically isn't permanently altered, aging is a scheduling-time adjustment.
  • "Is starvation the same problem in every scheduling algorithm?" The specific cause differs (shortest-job preference in SJF, versus priority-value preference in priority scheduling), but the underlying pattern, and aging as the fix, is the same: any selection criterion that ignores accumulated wait time risks starving some candidate indefinitely.

Key takeaways

  • Starvation in scheduling means a process is perpetually passed over because the algorithm's selection criterion never accounts for how long it's already waited.
  • SJF/SRTF and priority scheduling are both structurally vulnerable to this without a fix.
  • Aging fixes it by gradually increasing a waiting process's effective priority the longer it waits.
  • Real production schedulers build in aging-like fairness guarantees specifically to prevent this exact failure mode.
All 205 OS interview questions

Browse all Operating Systems topics

Log in to save which topics you've read across every subject.

Frequently asked questions

How can starvation occur in SJF, specifically?

If shorter processes keep continuously arriving, a longer process can be perpetually deprioritized and wait indefinitely, since SJF always favors whatever's currently shortest with no regard for existing wait time.

What is aging, precisely?

Gradually increasing a waiting process's effective priority (or effective selection-worthiness) the longer it waits, guaranteeing it eventually becomes favorable enough to be selected.

Does aging change a process's real, declared priority, or just how it's treated by the scheduler?

Only its effective priority for scheduling purposes; the process's originally assigned priority value itself typically isn't permanently altered, aging is a scheduling-time adjustment.

Is starvation the same problem in every scheduling algorithm?

The specific cause differs (shortest-job preference in SJF, versus priority-value preference in priority scheduling), but the underlying pattern, and aging as the fix, is the same: any selection criterion that ignores accumulated wait time risks starving some candidate indefinitely.