SSTF Disk Scheduling Algorithm
SSTF stands for Shortest Seek Time First. As the name specifies, this algorithm serves the task request that is closest to the current position of the head or pointer. Here, the direction of the head plays a vital role in determining total head movement. If there occurs a tie between requests then the head will serve the request which encounters it, in its ongoing direction. Unlike C-LOOK, the SSTF algorithm is very efficient in total seek time.
Example – Consider a disk with 200 tracks (0-199) and the disk queue having I/O requests in the following order as follows:
98, 183, 40, 122, 10, 124, 65
The current head position of the Read\Write head is 53 and will move in the right direction. Calculate the total number of track movements of the Read/Write head using the SSTF algorithm.
Total head movements = (65-53)+(65-40)+(40-10)+(98-10)+(122-98)+(124-122)+(183-124) = 240
Algorithm of SSTF
- Step 1: Let an array containing the indexes of the requested tracks be represented by the Request array. “head” refers to the disk head’s location.
- Step 2: Determine each track’s positive separation from the head in the request array.
- Step 3: Select a track with a minimal distance from the head from the specified array that hasn’t been accessed or serviced yet.
- Step 4: Using this distance, increase the total number of seeks.
- Step 5: The head position is now the currently serviced track position.
- Step 6: Repeat step 2 up until the request array’s last track is unserviced.
Advantages of SSTF
- It gets better and boosts throughput.
- The total search time of SSTF is less than that of FCFS.
- Both the average waiting time and response time are lower.
Disadvantages of SSTF
- Requests that are made distant from the head may result in starvation.
- Response and waiting times have a large degree of variety in the SSTF disk scheduling technique.
- Frequent direction changes of the head slow down the algorithm.
Difference Between SSTF and C-LOOK Disk Scheduling Algorithm
The secondary storage scheduling algorithm known as SSTF decides how the disk’s head and arm will move in response to read and write requests while in C-SCAN the head services request only in one direction(either left or right) until all the requests in this direction are not serviced and then jumps back to the farthest request in the other direction and services the remaining requests which gives a better uniform servicing as well as avoids wasting seek time for going till the end of the disk. You will discover the distinction between the SSTF and C-LOOK disk scheduling algorithms in this post. However, you must first understand the distinctions between the SSTF and C-LOOK disk scheduling algorithms.