The head of a hard disk serves requests following the shortest seek time first…

2007

The head of a hard disk serves requests following the shortest seek time first (SSTF) policy. The head is initially positioned at truck number 180. Which of the request sets will cause the head to change its direction after servicing every request assuming that the head does not change direction if there is a tie in SSTF and all the requests arrive before the servicing starts?

  1. A.

    11, 139, 170, 178, 181, 184, 201, 265

  2. B.

    10, 138, 170, 178, 181, 185, 201, 265

  3. C.

    10, 139, 169, 178, 181, 184, 201, 265

  4. D.

    10, 138, 170, 178, 181, 185, 200, 265

Attempted by 125 students.

Show answer & explanation

Correct answer: B

Answer: The request set 10, 138, 170, 178, 181, 185, 201, 265 causes the head to change direction after servicing every request.

Key idea: SSTF always picks the nearest outstanding request. If two requests are equidistant, the head does not change direction and will choose the request in the same direction as its last move.

  • Set: 11, 139, 170, 178, 181, 184, 201, 265 — fails because after moving 180 -> 181 (right) the two nearest are 184 and 178 (tie). The tie rule forces continuing right to 184, so the head does not change direction at that step.

  • Set: 10, 138, 170, 178, 181, 185, 201, 265 — simulate from 180:

    1. 180 -> 181 (right)

    2. 181 -> 178 (left)

    3. 178 -> 185 (right)

    4. 185 -> 170 (left)

    5. 170 -> 201 (right)

    6. 201 -> 138 (left)

    7. 138 -> 265 (right)

    8. 265 -> 10 (left)

    The movement direction alternates on every move, so this set meets the requirement.

  • Set: 10, 139, 169, 178, 181, 184, 201, 265 — fails for the same reason as the first set: after 180 -> 181 the nearest remaining are 184 and 178 (tie), and the tie rule prevents changing direction.

  • Set: 10, 138, 170, 178, 181, 185, 200, 265 — fails later: after 180 -> 181 -> 178 -> 185, the two nearest remaining from 185 are 170 and 200 (both distance 15). The tie rule forces continuing right to 200, so the head does not change direction at that step.

Therefore the correct request set is 10, 138, 170, 178, 181, 185, 201, 265.

Explore the full course: Gate Guidance By Sanchit Sir