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 track number 180. What is the maximum cardinality of the request set, so that the head changes its direction after servicing every request if the total number of tracks are 2048 and the head can start from any track?

  1. A.

    9

  2. B.

    10

  3. C.

    11

  4. D.

    12

Attempted by 151 students.

Show answer & explanation

Correct answer: C

Final answer: 11

Key idea: Think in terms of distance scales (powers of two). To force the SSTF head to change direction after every service, you can place requests so that their distances from the start are distinct powers of two and alternate sides. Each served request consumes the smallest remaining distance; because the distances on the same side increase by at least a factor of two, the nearest remaining request is always on the opposite side, so direction alternates.

  • Construction (existence of 11):

    Place requests so their distances from the start are 2^0, 2^1, 2^2, …, 2^10, alternating sides. SSTF always picks the smallest remaining distance, so picks will alternate sides and you get 11 serviced requests with a direction change after each service.

  • Argument for maximality (why you cannot have 12):

    Each alternation requires the presence of a strictly smaller remaining distance on the opposite side. Distinct halving scales (powers of two) provide a convenient way to guarantee this. The number of distinct power-of-two distance scales that fit within the total track range is at most log2(2048) = 11. Trying to force 12 alternations would require a twelfth distinct halving scale inside the 2048-track range, which is impossible, so 12 cannot be achieved.

Therefore the maximum cardinality of the request set for which the SSTF head changes direction after every service is 11.

Explore the full course: Gate Guidance By Sanchit Sir