Skip to main content

Short note: SSTF algorithm with example

Short answer

SSTF always serves the pending request nearest the current head position, repeating until the queue is empty. For head at 53 and queue 98,183,37,122,14,124,65,67, the order is 53,65,67,37,14,98,122,124,183 with total movement 236 cylinders. It reduces seek time but can starve distant requests.

Write a short note on Shortest Seek Time First algorithm with example.

Shortest Seek Time First (SSTF) is a disk scheduling algorithm that always serves the pending request closest to the current head position, i.e. the one needing the smallest seek.

Working

  1. Note the current head position.
  2. From the request queue, pick the cylinder with the minimum |request − head|.
  3. Move the head there, serve it, remove it from the queue.
  4. Repeat until the queue is empty. (Ties are broken arbitrarily, or by direction.)

Example

Head at 53; queue = 98, 183, 37, 122, 14, 124, 65, 67 (cylinders 0–199).

53 → 65 → 67 → 37 → 14 → 98 → 122 → 124 → 183
MoveDistance
53 → 6512
65 → 672
67 → 3730
37 → 1423
14 → 9884
98 → 12224
122 → 1242
124 → 18359
Total236

FCFS needs 640 cylinders for the same queue, so SSTF is much better.

Advantages and disadvantages

  • Lower average seek time and higher throughput than FCFS.
  • Not optimal in every case, because it is a greedy choice.
  • Starvation: requests far from the head may wait indefinitely if new requests keep arriving near the head.
  • Favours the middle cylinders; response time varies widely.

Answer: total head movement = 236 cylinders.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Operating System chapter 6 questions →