Sub topic 7
Choosing a Disk-Scheduling Algorithm
Assume you know how to compute cylinder distance and total head movement. You should also know that a disk request queue contains pending read or write requests, and that the disk head moves between cylinders. This chapter focuses on choosing an algorithm based on throughput, fairness, and starvation.
What to Compare
A scheduling algorithm should be judged using these properties:
- Total head movement: Less movement usually means shorter access time.
- Throughput: The number of requests completed per unit of time.
- Response time: How long a request waits before service begins.
- Fairness: Whether requests receive reasonably equal treatment.
- Starvation: Indefinite postponement of a request.
The best algorithm depends on the workload. A choice that minimizes movement can still be unfair.
| Algorithm | Main rule | Fairness and starvation | Typical trade-off |
|---|---|---|---|
| FCFS | Serve requests in arrival order | Fair; no starvation | Simple, but often high movement |
| SSTF | Serve the nearest pending request | Can starve distant requests | Good average movement, weaker fairness |
| SCAN | Move in one direction, then reverse at an edge | Generally fair | More edge travel than necessary |
| C-SCAN | Serve in one direction, then return to the start | Uniform waiting times | Extra movement during the return |
| LOOK | Like SCAN, but reverse at the last request | Generally fair | Less movement than SCAN |
| C-LOOK | Like C-SCAN, but jump between last and first requests | Uniform waiting times | Jump still costs movement |
How the Algorithms Behave
FCFS provides predictable ordering. It is suitable when fairness and implementation simplicity matter more than performance. Its weakness is that adjacent requests may be separated by unrelated requests, causing unnecessary movement.
SSTF chooses the request closest to the current head position. It often reduces immediate movement and improves average response time. However, a steady stream of nearby requests can repeatedly bypass a request on the opposite side of the disk.
SCAN, sometimes called the elevator algorithm, moves across the disk while serving requests, then reverses direction. It limits starvation because every request is eventually reached. LOOK improves SCAN by reversing at the final request in the current direction instead of traveling to the physical edge.
C-SCAN serves requests in one direction only. After reaching the edge, the head returns to the beginning without serving requests during the return. C-LOOK uses the same policy but jumps from the last request in one direction to the first request in the other direction. These circular policies provide more uniform waiting times.
Choosing by Workload
- Choose FCFS when strict arrival order is required.
- Choose SSTF when average movement is the main concern and starvation is acceptable or controlled.
- Choose SCAN or LOOK for a balanced general-purpose policy.
- Choose C-SCAN or C-LOOK when predictable, uniform waiting time matters.
Exercise
Which algorithm can minimize local head movement but starve a request far from the current head?
Show answer
SSTF. Nearby requests can continue to arrive and repeatedly bypass the distant request.