On a disk with 1000 cylinders numbered 0 to 999, find the number of tracks the…
2012
On a disk with 1000 cylinders numbered 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. Assume the SCAN algorithm is used. The queue, in FIFO order, contains requests for the following tracks: 123, 874, 692, 475, 105, 376.
- A.
2013
- B.
1219
- C.
1967
- D.
1507
Attempted by 68 students.
Show answer & explanation
Correct answer: B
Concept: The SCAN (elevator) disk-scheduling algorithm keeps moving the head in its current direction, servicing every pending request it passes, until it reaches the disk's physical boundary in that direction -- even if no request sits exactly at that boundary -- because the head is already committed to travelling that way. Once it reverses, it continues in the new direction only as far as the farthest pending request still waiting there; once that request is serviced, every request in the queue has been handled, so no further movement is needed or counted. Total head movement is therefore the distance from the head's starting position to the boundary in its initial direction, plus the distance from that boundary to the farthest pending request in the reversed direction -- and depends only on the sorted positions of the pending requests, never on the order they arrived in the queue.
Application: sort the requests and trace the SCAN path step by step.
Sort the pending requests by track number: 105, 123, 376, 475, 692, 874. The head starts at 345, moving toward 0.
Service every pending request below 345 while descending -- 123, then 105 -- and continue to the boundary at 0. Distance covered = 345 - 0 = 345 tracks.
Reverse and climb, servicing every pending request above 345 in ascending order -- 376, 475, 692 -- up to the farthest one, 874. Distance covered = 874 - 0 = 874 tracks.
Total head movement = 345 + 874 = 1219 tracks.
Cross-check: sum the individual segments along the same path instead. 345 to 123 is 222, 123 to 105 is 18, 105 to 0 is 105 (222 + 18 + 105 = 345, matching the first leg); then 0 to 376 is 376, 376 to 475 is 99, 475 to 692 is 217, 692 to 874 is 182 (376 + 99 + 217 + 182 = 874, matching the second leg). 345 + 874 = 1219, confirming the total independently.
This is UGC NET June 2012, Computer Science and Applications, Paper III (Q74); the official UGC answer key confirms this total.
A video solution is available for this question — log in and enroll to watch it.