How does priority scheduling work, and how are priorities assigned to processes?

Last updated 5 July 2026

Priority scheduling assigns each process a priority number and always runs the ready process with the highest priority; the CPU is given to the most important task rather than simply the earliest or shortest one.

  • How it works:

    • The scheduler picks the highest-priority ready process (convention varies: often a lower number means higher priority).

    • Can be preemptive (a higher-priority arrival immediately takes the CPU) or non-preemptive (it waits for the running process to yield).

  • How priorities are assigned:

    • Static / external: set by the user, admin, or importance (e.g. Unix nice values) and don't change on their own.

    • Dynamic / internal: computed by the OS from metrics like memory needs, I/O-to-CPU ratio, or waiting time, and adjusted at runtime.

  • Main problem: starvation: Low-priority processes may never run if high-priority ones keep arriving.

  • Fix: aging: Gradually raise the priority of processes that have waited a long time, guaranteeing they eventually run.

  • https://www.geeksforgeeks.org/operating-systems/priority-scheduling-in-operating-system/
  • https://www.geeksforgeeks.org/operating-systems/difference-between-preemptive-priority-based-and-non-preemptive-priority-based-cpu-scheduling-algorithms/
  • https://medium.com/@deokaranush/priority-based-cpu-scheduling-algorithm-in-operating-systems-beeb3b3009a0
  • https://data-flair.training/blogs/priority-scheduling-algorithm-in-operating-system/
  • https://medium.com/@rudrab1914/operating-system-scheduling-algorithms-priority-based-scheduling-0d06b1ea51ed
  • https://www.tutorialspoint.com/operating_system/os_priority_scheduling_algorithm.htm
All Operating Systems interview questions