Priority Scheduling Explained

Scheduling by Importance, Not Just Arrival or Length

Priority Scheduling assigns each process a priority value, and always runs the highest-priority process available - rather than the earliest arrival (FCFS) or the shortest job (SJF), both covered earlier in this section.

A Worked Example

Process   Burst Time   Priority (lower number = higher priority)
P1        10           3
P2        1            1
P3        2            4
P4        1            2
P5        5            5

Execution order (by priority): P2 -> P4 -> P1 -> P3 -> P5

Notice this ordering has nothing to do with each process's burst time directly - P2 runs first purely because it has the highest priority (lowest number), even though other processes might be shorter or have waited longer.

Where a Priority Value Actually Comes From

  • Internally - based on factors like memory requirements or how many open files a process has.
  • Externally - assigned by the system administrator, or based on how important a user or application is considered.

The Classic Weakness: Indefinite Starvation

A low-priority process can wait indefinitely if higher-priority processes keep arriving continuously - in the worst case, it may never run at all, a genuinely serious fairness problem for any long-running system.

Aging: The Standard Fix for Starvation

A waiting process's priority gradually increases the longer it waits,
until eventually even a low-priority process becomes high-priority
purely by having waited long enough.

Aging gradually increases a process's priority the longer it waits, guaranteeing that even an initially low-priority process will eventually become high-priority enough to run - directly solving the starvation problem without abandoning the core idea of priority-based scheduling. This exact technique is explored in more depth in the dedicated starvation and aging notes later in this section.

Written by Lorens Mishra

Software Engineer Notes Management System Administrator

Discussion

0 comments
Sign in to join the discussion.

No comments yet. Be the first to say something.