SSTF: Shortest Seek Time First


In SSTF (Shortest Seek Time First) disk scheduling algorithm we have to calculate the seek time first.
That is, before serving any request, seek time is calculated for each request and then the request with least seek time will be served.
If we define in terms of hardware then, the request which are closure to disk head position will be served first. SSTF also aims to overcome some of the limitations in FCFS.


Advantages:


Disadvantages:

Example:

Steps to Implement Algorithm:

  1. Let Request array represents an array storing indexes of tracks that have been requested. ‘head’ is the position of disk head.
  2. Find the positive distance of all tracks in the request array from head.
  3. Find a track from requested array which has not been accessed/serviced yet and has minimum distance from head.
  4. Increment the total seek count with this distance.
  5. Currently serviced track position now becomes the new head position.
  6. Go to step 2 until all tracks in request array have not been serviced.

Time Complexity: O ( N2 )   Auxiliary Space: O ( N )

Simulate