Skip to content

22. Priority Scheduling

Every process gets a priority number; the CPU always goes to the highest-priority ready process (convention varies on which number means "higher").

Static vs dynamic priority: static is assigned once; dynamic changes based on behavior (this is how MLFQ works internally).

The starvation problem: if high-priority work keeps arriving, low-priority processes never run. Fix — aging: gradually raise a waiting process's priority (e.g., +1 per second waited) until it eventually runs.

Interview point: SJF is priority scheduling where priority = 1/burst time — same algorithm, different priority metric.