SSTF (Shortest-Seek-Time-First) Disk Scheduling Algorithm
SSTF is another type of scheduling algorithm. In this type of disk scheduling, the job which has less seek time will be executed first. So, in SSTF (shortest seek time first) scheduling, we have to calculate the seek time first. and after calculating the seek time, each request will be served on the basis of seek time. The request which is close to the disk arm will be first executed. There are some drawbacks in FCFS. To overcome the limitations that arise in the FCFS. SSTF scheduling is implemented.
Algorithm:
Let Request array represents an array storing indexes of tracks that have been requested. ‘head’ is the position of disk head.
Find the positive distance of all tracks in the request array from head.
Find a track from requested array which has not been accessed/serviced yet and has minimum distance from head.
Increment the total seek count with this distance.
Currently serviced track position now becomes the new head position.
Go to step 2 until all tracks in request array have not been serviced.
Video:
Advantages of SSTF Disk scheduling Algorithm:
The advantages of SSTF disk scheduling algorithm are:
In SSTF disk scheduling, the average response time is decreased.
Increased throughput.
Disadvantages of SSTF Disk Scheduling Algorithm:
The disadvantages of SSTF disk scheduling algorithm are:
In SSTF, there may be a chance of starvation.
SSTF is not an optimal algorithm.
There are chances of overhead in SSTF disk scheduling because, in this algorithm, we have to calculate the seek time in advanced.
The speed of this algorithm can be decreased because direction could be switched frequently.