CPU Scheduling Algorithms
Master how the Operating System decides which process runs next to maximize CPU utilization and responsiveness.
What is CPU Scheduling?
In a multi-programming environment, multiple processes exist in the memory simultaneously. The primary goal of an operating system is to maximize CPU utilization by switching the CPU among processes efficiently.
When the CPU becomes idle, the short-term scheduler picks from processes in the ready queue and allocates the CPU to one of them.
Core Scheduling Metrics
- Arrival Time (AT): When a process enters the ready queue.
- Burst Time (BT): Time required for execution on the CPU.
- Turnaround Time (TAT): Exit Time - Arrival Time.
- Waiting Time (WT): Turnaround Time - Burst Time.
The 4 Core Algorithms
1. FCFS (First Come First Served)
The simplest scheduling algorithm. The process that arrives first is executed first. It is non-preemptive.
2. SJF (Shortest Job First)
Picks the process with the smallest remaining burst time. Can be preemptive or non-preemptive.
3. Priority Scheduling
Processes are assigned priorities. The CPU is given to the process with the highest priority first.
4. Round Robin (RR)
Assigns a fixed "Time Quantum" to each process cyclically. Highly preemptive and fair.
Ready to Understand Them Visually?
Don't just read about them. Use our interactive visualizer to step through FCFS, SJF, Priority, and Round Robin on your own custom processes. Watch the Gantt chart build in real-time.
Launch Interactive Visualizer →