Disk Scheduling Algorithm Simulator
Compare classic disk-scheduling policies on one request queue with animated service order, endpoint events, and total head movement.{{ summaryTitle }}
{{ summaryLine }}
{{ primaryCopyAnnouncement }}
The chart renderer is unavailable. The exact path remains available in the head trace and movement ledger.
{{ algorithmLabel }} trace
Inspect every service, physical endpoint, and circular wrap in the canonical path.
{{ currentDecision }}
{{ serviceOrderText }}
Educational model: cylinder distance approximates seek movement for classic magnetic-disk examples. It excludes arrival times, rotational latency, transfer time, firmware reordering, and modern device-specific schedulers.
| Step | Kind | Movement | Distance | Request | Decision | Copy |
|---|---|---|---|---|---|---|
| {{ row.step }} | {{ row.kindLabel }} | {{ row.from }} → {{ row.to }} | {{ row.distance }} cylinders | {{ row.requestId || '—' }} | {{ row.reason }} |
On a moving-head magnetic disk, serving requests in a different order changes how far the head travels between cylinders. A short path can reduce seek work, but the shortest-looking next move is not automatically the fairest policy for requests that have waited longer.
Classic disk-scheduling algorithms expose that tradeoff by applying different ordering rules to the same pending queue.
| Policy | Service rule | Main lesson |
|---|---|---|
| FCFS | Keep arrival order. | Simple and predictable, but the head may cross the disk repeatedly. |
| SSTF | Choose the nearest pending cylinder. | Often reduces movement, but a steady stream of nearby requests can delay distant ones. |
| SCAN | Sweep in one direction to the disk endpoint, then reverse. | Orders service like an elevator and avoids repeated local choices. |
| C-SCAN | Sweep one way, wrap at the endpoint, and resume in the same direction. | Creates a more uniform directional service pattern. |
| LOOK | Reverse at the last pending request rather than the physical endpoint. | Avoids travel through an empty tail of the cylinder range. |
| C-LOOK | Wrap from the last request in one direction to the farthest pending request on the other side. | Combines circular service with request-bounded travel. |
Head movement is a teaching proxy for seek distance, not a complete latency model. Rotational delay, transfer time, request priorities, caching, controller remapping, and newly arriving requests can change real performance. Solid-state storage has no moving head, and current operating systems use schedulers that address workloads and device behavior beyond these textbook policies.
A fair comparison keeps the queue, starting cylinder, cylinder range, and initial direction fixed. Changing any of them changes the path independently of the selected algorithm.
How to Use This Tool:
Use one request queue as a controlled experiment, then switch policies to compare service order and movement.
- Select FCFS, SSTF, SCAN, C-SCAN, LOOK, or C-LOOK.
- Enter 1 to 12 request cylinders separated by commas, spaces, or semicolons. Repeated cylinders remain separate requests in their original order.
- Set the inclusive Maximum cylinder from 1 to 9,999 and place Starting head between 0 and that maximum.
- Choose the initial direction for SCAN, C-SCAN, LOOK, or C-LOOK. FCFS and SSTF ignore that choice.
- Replay or step through the trace. Compare Total head movement, service order, and endpoint or wrap events before changing algorithms.
Interpreting Results:
Total head movement adds every service, endpoint, and wrap distance. Average movement divides that total by the number of requests, so it is comparable only when the queue and cylinder scale stay fixed.
- A lower total means less movement for this fixed queue; it does not establish lower real I/O latency or better fairness.
- Endpoint rows in SCAN and C-SCAN count travel to cylinder 0 or the selected maximum even when no request is there.
- Wrap rows in C-SCAN and C-LOOK count distance but do not service a request at the destination until the next service event.
- When requests are equally near, SSTF keeps their original queue order. Directional policies also keep source order for duplicate cylinders.
Technical Details:
A trace is an ordered series of head positions. Each event records the absolute difference between its starting and ending cylinder; zero-distance requests at the current head still count as serviced requests.
Formula Core:
For head positions h0 through hm, total movement is the sum of absolute consecutive differences. The displayed average uses the request count n, not the number of trace events.
Movement is reported in cylinder units. Total movement is an integer; the average retains full division precision until display formatting.
Mechanism Core:
| Algorithm | Ordered mechanism | Tie or turn rule |
|---|---|---|
| FCFS | Visit requests in source order. | No reordering. |
| SSTF | Recompute the nearest pending request after every service. | Equal distance keeps source order. |
| SCAN | Service sorted requests in the initial direction, visit the endpoint when work remains beyond the head, then reverse. | Duplicate cylinders keep source order. |
| C-SCAN | Service in one direction, visit the endpoint, wrap to the opposite endpoint, and continue in the same direction. | The wrap is a non-service movement. |
| LOOK | Service in one direction and reverse at the last pending request. | No physical-endpoint event is added. |
| C-LOOK | Service in one direction, wrap to the farthest pending request on the other side, then continue. | The wrapped-to request is serviced in the following event. |
References:
- Operating Systems: Mass-Storage Structure, section 10.4, University of Illinois Chicago.
- Switching Scheduler, Linux kernel documentation.