A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Priority Scheduling Algorithms

College Depth 102 in the knowledge graph ☐ I know this ☆ Set as goal
2topics build on this
366prerequisites beneath it
See this on the map →
CPU Scheduling FundamentalsFirst-Come-First-Served (FCFS) Scheduling+1 more→→Multilevel Feedback Queue (MLFQ) SchedulingReal-Time Scheduling Algorithms
scheduling-algorithms priority-based starvation-risk

Core Idea

Priority scheduling associates a priority with each process and runs the highest-priority process. Preemptive variants interrupt lower-priority processes when higher-priority ones arrive. However, priority scheduling can starve low-priority processes and requires careful priority assignment and aging techniques to prevent pathological behavior.

Common Misconceptions

Higher priority always means faster execution (depends on competing processes and workload). Static priorities are always better (dynamic/adaptive priorities often prevent starvation).

Explainer

From CPU scheduling basics, you understand that the scheduler chooses which ready process runs next and that different algorithms optimize for different goals. Priority scheduling assigns each process a numerical priority value and always runs the highest-priority ready process. Unlike FCFS, which uses arrival order, or Shortest Job First, which uses burst time, priority scheduling uses an externally assigned importance ranking — the OS or the user decides which processes matter most. This makes it the natural choice for systems where some tasks are genuinely more urgent than others: a real-time audio driver should preempt a background file indexer, not wait behind it.

Priority scheduling comes in two flavors. In the non-preemptive variant, once a process starts running, it keeps the CPU until it finishes or blocks, even if a higher-priority process arrives in the meantime. In the preemptive variant, a newly arrived or newly unblocked process with higher priority immediately interrupts the currently running process. Preemptive priority scheduling is more responsive — a high-priority task gets the CPU as soon as it needs it — but requires more context switches. Most real operating systems use preemptive priority scheduling because responsiveness matters: when you move your mouse, the interrupt handler and input processing should preempt your background compilation, not wait for it to finish.

The critical problem with priority scheduling is starvation: a low-priority process may never run if higher-priority processes keep arriving. Imagine a system where interactive tasks (high priority) constantly arrive — a batch job sitting at low priority could wait hours or even indefinitely. The standard solution is aging: the OS gradually increases the priority of processes that have been waiting a long time. After enough time in the ready queue, even the lowest-priority process eventually reaches a priority high enough to run. Aging ensures that priority scheduling has a bounded worst-case waiting time rather than an unbounded one.

In practice, priorities can be static (assigned once, fixed for the process lifetime) or dynamic (adjusted by the OS based on behavior). Many systems use dynamic priorities to balance responsiveness and throughput: a process that has been I/O-bound (frequently blocking on I/O) gets a priority boost because it is likely to use only a small burst of CPU time before blocking again, keeping I/O devices busy. A process that has been CPU-bound gets its priority reduced to prevent it from monopolizing the CPU. Linux's Completely Fair Scheduler (CFS) and Windows' multilevel feedback queue both incorporate priority with dynamic adjustment. Understanding pure priority scheduling gives you the building block for these more sophisticated multilevel schemes, where processes move between priority bands based on their observed behavior.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Boolean Algebra and Fundamental Laws → Logic Gates Fundamentals → Implementing Boolean Functions with Gates → Karnaugh Map Simplification → Combinational Circuit Design → Flip-Flops and Latches → Binary Counters: Design and Analysis → Binary Arithmetic → Fixed-Point Number Representation → Two's Complement Representation → Overflow and Underflow Detection → Binary Adders: Half-Adders and Full-Adders → Full Adder and Carry Propagation → Carry Lookahead Adder Design → Half Adder Circuit Design → Multiplication Circuit Design → Sequential Circuit Design → Registers and Register Files → Instruction Set Architecture (ISA) → Kernel Architecture and OS Structure → System Calls and User/Kernel Mode → Processes and the Process Control Block → Process Creation: fork() and exec() → Process Termination and Resource Cleanup → Process States and State Transitions → Process Model Formalization → Context Switching and CPU Dispatch → CPU Scheduling Fundamentals → Round-Robin (RR) Scheduling → First-Come-First-Served (FCFS) Scheduling → Priority Scheduling Algorithms

Longest path: 103 steps · 366 total prerequisite topics

Prerequisites (3)

Leads To (2)