SHORTEST SEEK TIME FIRST ALGORITHM

Let's Explore

Image

 

Description of the algorithm:

Shortest seek time first (SSTF) algorithm selects the disk I/O request which requires the least disk arm movement from its current position regardless of the direction. It reduces the total seek time as compared to FCFS. It allows the head to move to the closest track in the service queue.

Image

 

Flow of the 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.

Image

 

Implementation of the algorithm:

Image

 

Output of the algorithm: