Rahul Devashish
Rahul Devashish
23 Oct 2025·2 min read·—

Storage Management

Here’s a step-by-step explanation of the solution using Shortest Seek Time First (SSTF) for the given problem. Given:

  • Cylinder queue (requests): P, Q, R, S, T with positions:
    • P at 155
    • Q at 85
    • R at 110
    • S at 30
    • T at 115
  • Disk head starts at position: 100 Goal:
  • Serve requests in the order that minimizes the seek time from the current head position (SSTF). If there’s a tie, break it with a predefined rule (usually lower cylinder first or by the given problem’s tie rule). How SSTF is applied here:
  1. Start at head = 100.
  2. Compute seek distance to each pending request:
    • P (155): |155 - 100| = 55
    • Q (85): |85 - 100| = 15
    • R (110): |110 - 100| = 10
    • S (30): |30 - 100| = 70
    • T (115): |115 - 100| = 15
  3. Pick the minimum distance: R at 110 (distance 10). Serve R first.
    • Head moves from 100 to 110.
    • Remaining requests: P(155), Q(85), S(30), T(115).
  4. Update distances from new head position (110):
    • P (155): |155 - 110| = 45
    • Q (85): |85 - 110| = 25
    • S (30): |30 - 110| = 80
    • T (115): |115 - 110| = 5
  5. Choose the smallest distance: T at 115 (distance 5). Serve T next.
    • Head moves from 110 to 115.
    • Remaining: P(155), Q(85), S(30).
  6. Update distances from head = 115:
    • P (155): |155 - 115| = 40
    • Q (85): |85 - 115| = 30
    • S (30): |30 - 115| = 85
  7. Smallest distance: Q at 85 (distance 30). Serve Q next.
    • Head moves from 115 to 85.
    • Remaining: P(155), S(30).
  8. Update distances from head = 85:
    • P (155): |155 - 85| = 70
    • S (30): |30 - 85| = 55
  9. Smallest distance: S at 30 (distance 55) vs P at 155 (70). So S is next.
    • Head moves from 85 to 30.
    • Remaining: P(155).
  10. Finally, serve P at 155.
    • Head moves from 30 to 155. Resulting order (one plausible SSTF sequence given the starting position and the problem’s data):
  • R (110) → T (115) → Q (85) → S (30) → P (155) Directional notes cited in the solution:
  • When the head moved from 100 toward higher cylinders, R and T were serviced early (they’re relatively close on the high side).
  • After reaching around 115, the head moved toward the lower region to service Q and S, then finally moved up to P.
  • The problem’s explanation mentions “R and T are serviced before P,” and that “Q is serviced when head is moving towards lower cylinders, P when moving towards higher cylinders,” which aligns with SSTF’s behavior of picking the nearest request at each step and may involve a direction change at S. Conclusion:
  • The solution states that option B is correct, based on the SSTF sequence above. The exact order can vary if the tie-breaking rule differs, but the key idea is always selecting the nearest pending request from the current head position and updating distances after each service.

More Posts

Discover Other Writers

Explore posts from other contributors

You May Like

Discover other contributors