Skip to content
We areTOP 1%

How do priority and multilevel queue scheduling work, and how does aging prevent starvation?

HardConceptCPU Scheduling
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

Priority scheduling gives every process a priority number and always runs the highest-priority ready process; often a smaller number means a higher priority. It can be preemptive or non-preemptive. Multilevel queue scheduling splits the ready queue into separate queues by process type, for example a foreground queue for interactive processes and a background queue for batch jobs, each with its own algorithm and a fixed priority between the queues.

  • Both can cause starvation: a low-priority process may wait forever if higher-priority work keeps arriving.
  • Aging fixes this by gradually raising the priority of a process the longer it waits, so it eventually runs.
  • A multilevel feedback queue also lets processes move between queues: CPU-heavy processes are demoted and long-waiting ones are promoted.

Example: non-preemptive priority, all arriving at time 0 (lower number = higher priority):

ProcessBurstPriorityRunsWaiting
P2210–20
P3322–52
P1435–95

Average waiting = 7 / 3 ≈ 2.33. If new priority-1 jobs kept arriving, P1 could starve; with aging, its priority improves every few seconds until it reaches the top. Similarly, a background FCFS queue runs only when the foreground Round Robin queue is empty.

More in CPU Scheduling

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account