- 2072 Magh · 4 marks
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
- Note the current head position.
- From the request queue, pick the cylinder with the minimum |request − head|.
- Move the head there, serve it, remove it from the queue.
- 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
| Move | Distance |
|---|---|
| 53 → 65 | 12 |
| 65 → 67 | 2 |
| 67 → 37 | 30 |
| 37 → 14 | 23 |
| 14 → 98 | 84 |
| 98 → 122 | 24 |
| 122 → 124 | 2 |
| 124 → 183 | 59 |
| Total | 236 |
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)
Related questions
- Interleaving; SSTF, SCAN, C-SCAN order · Operating System, chapter 6
- Disk scheduling with 100 cylinders · Operating System, chapter 6 · asked 2×
- Preemptive vs non-preemptive; real-time scheduling · Operating System, chapter 2
- Rate Monotonic real-time schedule · Operating System, chapter 2
- Preemptive priority and SRTF Gantt · Operating System, chapter 2
- Dijkstra's shortest path algorithm · Data Structure and Algorithm, chapter 10 · asked 2×
- Dijkstra shortest path (2071 Bhadra) · Discrete Structure, chapter 4 · asked 4×
- Dijkstra shortest path (2070 Magh) · Discrete Structure, chapter 4 · asked 4×
- Dijkstra shortest path (2069 Bhadra) · Discrete Structure, chapter 4 · asked 4×