Shortest Seek Time First (SSTF) Disk Scheduling
Shortest Seek Time First (SSTF) Disk Scheduling
Aim
To simulate the SSTF disk scheduling algorithm and compute the total head movement, displaying Step, From, To, Movement.
Theory
Shortest Seek Time First (SSTF) selects the disk request that is closest to the current head position.
-
Minimizes immediate seek time
-
Improves performance compared to FCFS
-
May cause starvation for far-away requests
Algorithm
-
Read number of disk requests.
-
Read request queue.
-
Read initial head position.
-
Mark all requests as unvisited.
-
From current head:
-
Find request with minimum absolute distance
-
Move head to that request
-
Add movement to total
-
Mark request visited
-
-
Repeat until all requests are serviced.
Program: SSTF Disk Scheduling (C)
Same Example as FCFS
Input
Sample Run (SSTF Order Selection)
Current head = 53
Nearest sequence:
53 → 65 → 67 → 37 → 14 → 98 → 122 → 124 → 183
Output Table
Observation
| Algorithm | Total Head Movement |
|---|---|
| FCFS | 640 |
| SSTF | 236 |
👉 SSTF significantly reduces head movement compared to FCFS.
Result
The SSTF disk scheduling algorithm was successfully simulated.
For the given example, total head movement = 236 tracks, which is lower than FCFS.
Comments
Post a Comment