Shortest Seek Time Algorithm

The Shortest Seek Time Algorithm (SSTF) is a disk scheduling method which choses the empty memory space with the least distance from its current position. In this method, when an array of disk track numbers and initial head position are given, the task is to find the total number of seek operations carried out to access all the requested tracks. This is done in the algorithm also known as Shortest Seek Time First (SSTF).

The primary concept behind this algorithm is to allocate memory which is located closest to the memory head in order to minimize the overall seek operations.

Example

If the request sequence for memory allocation is, {150, 75, 30, 90, 10, 40, 120}.

Initial head position = 55

The chart given below shows the sequence of memory allocation using SSTF algorithm.

Algorithm for SSTF Scheduling

Step 1. Start 

Step 2. Store all the storing indexes of the tracks that have been requested.

Step 3. Calculate the positive distance of all the tracks in the request array from the head.

Step 4. Identify an empty track from the requested array with the least distance from head.

Step 5. Increment the total seek count with this identified distance.

Step 6. The currently allocated track position becomes the new head position.

Step 7. Go to step 3 un till all the requested tracks have not allocated.

Step 8. Stop.