Learning outcomes
- Evaluate first‑come first‑serve, shortest job first, priority, round robin and multilevel queue scheduling algorithms.
CPU scheduling is the operating-system activity of selecting one process from the ready queue and allocating the CPU to it. The goal is not just to “keep the CPU busy,” but to do so with good performance, fairness, and responsiveness. In this note, we evaluate FCFS, SJF, Priority, Round Robin, and Multilevel Queue scheduling algorithms.
To evaluate a scheduling algorithm, we use standard performance measures.
| Criterion | Meaning | Desired Trend |
|---|---|---|
| CPU Utilization | Percentage of time the CPU is doing useful work | Higher is better |
| Throughput | Number of processes completed per unit time | Higher is better |
| Turnaround Time | Total time from submission to completion | Lower is better |
| Waiting Time | Total time spent waiting in the ready queue | Lower is better |
| Response Time | Time from submission until first response | Lower is better |
| Fairness | Whether processes get a reasonable share of CPU time | Balanced |
In FCFS, the process that arrives first gets the CPU first. It is the simplest non-preemptive scheduling algorithm.
| Aspect | Evaluation of FCFS |
|---|---|
| Simplicity | Excellent |
| Average waiting time | Often poor |
| Response time for short jobs | Poor if a long job comes first |
| Fairness | Arrival-order fair, but not performance fair |
SJF selects the process with the smallest CPU burst next. It may be non-preemptive or, in its preemptive form, called Shortest Remaining Time First (SRTF).
SJF is famous because it gives the minimum average waiting time among all scheduling algorithms, provided burst lengths are known exactly.
| Aspect | Evaluation of SJF |
|---|---|
| Average waiting time | Best possible in theory |
| Turnaround time | Usually very good |
| Implementation | Difficult because next CPU burst must be estimated |
| Fairness | Can be unfair to long jobs |
If processes have burst times 10, 2, and 1, SJF runs 1 first, then 2, then 10. That sharply reduces average waiting time compared with FCFS.
In priority scheduling, the CPU is allocated to the process with the highest priority. Depending on convention, either a smaller number or a larger number may indicate higher priority.
| Aspect | Evaluation of Priority Scheduling |
|---|---|
| Flexibility | Very useful when some jobs are more important than others |
| Response for urgent jobs | Good |
| Fairness | Can be poor for low-priority jobs |
| Main problem | Starvation of low-priority processes |
Round Robin is designed mainly for time-sharing systems. Each process gets the CPU for a fixed small unit of time called a time quantum. If the process does not finish within that quantum, it is preempted and placed at the end of the ready queue.
| Aspect | Evaluation of Round Robin |
|---|---|
| Response time | Very good for interactive systems |
| Fairness | Good; every process gets a turn |
| Waiting time | Moderate; depends on quantum |
| Overhead | Higher due to context switching |
In Multilevel Queue Scheduling, the ready queue is split into several separate queues. Each queue may represent a different class of processes, such as:
Each queue can have its own scheduling algorithm. For example:
| Aspect | Evaluation of Multilevel Queue |
|---|---|
| Specialization | Very good; different workloads can be handled differently |
| Interactive response | Good if higher queues are assigned to interactive jobs |
| Fairness | Can be poor if lower queues get too little CPU |
| Complexity | Higher than FCFS or RR |
| Algorithm | Main strength | Main weakness | Best suited for |
|---|---|---|---|
| FCFS | Very simple and easy to implement | Convoy effect; poor response for short jobs | Simple batch systems |
| SJF | Minimum average waiting time | Needs burst prediction; long jobs may wait | Batch workloads where burst estimates are possible |
| Priority | Urgent jobs can be favored | Starvation of low-priority jobs | Systems with importance-based tasks |
| Round Robin | Good response and fairness | Context-switch overhead; depends on quantum | Interactive and time-sharing systems |
| Multilevel Queue | Different policies for different job classes | Complex; lower queues may starve | Mixed workloads with clear job categories |
FCFS is the simplest scheduling algorithm, but its average waiting and response time may be poor.
SJF gives the best average waiting time in theory, but it depends on burst-time prediction.
Priority Scheduling is useful when some tasks are more important, but starvation is a serious concern.
Round Robin is widely used in interactive systems because it gives fast response and fair CPU sharing.
Multilevel Queue Scheduling is powerful when different types of jobs need different policies, but it is more complex and can also starve lower queues.