On a disk with 1000 cylinders (0 to 999), find the number of tracks the disk…
2012
On a disk with 1000 cylinders (0 to 999), find the number of tracks the disk arm must move to satisfy all the requests in the disk queue. Assume the last request serviced was at track 345 and the head is moving toward track 0. The queue, in FIFO order, contains requests for the following tracks: 123, 874, 692, 475, 105, 376. (Assume the SCAN algorithm.)
Answer: B. 1219 — Concept SCAN — the elevator algorithm — keeps the disk arm moving in the direction it is already travelling, serving every pending request it passes, until it…
- A.
2013
- B.
1219
- C.
1967
- D.
1507
Attempted by 15 students.
Show answer & explanation
Correct answer: B
Concept
SCAN — the elevator algorithm — keeps the disk arm moving in the direction it is already travelling, serving every pending request it passes, until it reaches the end cylinder on that side of the disk. Only then does the arm reverse and serve the requests waiting in the opposite direction.
Two turning points therefore fix the total head movement: the disk end in the initial direction of travel, and, on the return sweep, the farthest pending request, since the arm has nothing left to travel toward once the queue is empty. Total movement is the sum of the leg lengths, and the FIFO arrival order changes nothing.
Application
The arm starts at track 345 and is moving inward, toward track 0, on a disk spanning cylinders 0 to 999.
Travelling inward, the arm passes and serves the pending requests that lie below 345: first 123, then 105.
It does not turn at 105; SCAN carries the arm to the end cylinder in that direction, cylinder 0. Inward leg = 345 − 0 = 345 tracks.
The arm reverses at cylinder 0 and travels outward, serving 376, 475, 692 and 874 in that order.
874 is the farthest pending request, so the outward sweep ends there. Outward leg = 874 − 0 = 874 tracks.
Total head movement = 345 + 874 = 1219 tracks.
Cross-check
The same result follows from the closed form for an inward-first SCAN: total = (start − lower end) + (highest request − lower end) = (345 − 0) + (874 − 0) = 1219 tracks. Re-shuffling the queue leaves this unchanged, because the turning points are set by the algorithm and the extreme request values, not by arrival order.
Contrast with other traversals
Path taken by the arm | Legs | Total tracks |
|---|---|---|
Turn at cylinder 0, then outward to 874 (SCAN) | 345 + 874 | 1219 |
Serve strictly in queue order 345 → 123 → 874 → 692 → 475 → 105 → 376 | 222 + 751 + 182 + 217 + 370 + 271 | 2013 |
Turn at the lowest request 105, then outward to 874 (LOOK) | 240 + 769 | 1009 |
Turn at 105, outward to 874, then back inward to 376 (C-LOOK) | 240 + 769 + 498 | 1507 |
Turn at cylinder 0, outward to cylinder 999, then back inward to 376 (C-SCAN) | 345 + 999 + 623 | 1967 |