# Difference between SSTF and LOOK disk scheduling algorithm

1. SSTF disk scheduling algorithm :
SSTF stands for Shortest Seek Time First. As the name specify, this algorithm serves the task request which is closest to current position of head or pointer. Here, the direction of head plays an 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.

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 Right direction. Calculate the total number of track movements of Read/Write head using SSTF algorithm.

```= (65-53)+(65-40)+(40-10)+(98-10)
+(122-98)+(124-122)+(183-124)
= 240 ```

2. LOOK disk scheduling algorithm :
Look Algorithm is actually an improves version of SCAN Algorithm. In this algorithm, the head starts the first request at one side of disk and moves towards the other end by serving all requests in between. Unlike SCAN, in this the head instead of going till last track, it goes till last request and then direction is changed. Unlike SSTF, it doesn’t serves the task request which is closest to current position of head or pointer.

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 Right direction . Calculate the total number of track movements of Read/Write head using LOOK algorithm.

```= (65-53)+(98-65)+(122-98)
+(124-122)+(183-124)+(183-40)+(40-10)
= 303 ```

Difference between SSTF and LOOK disk scheduling algorithm :

LOOK SCHEDULING ALGORITHM SSTF SCHEDULING ALGORITHM
1. The performance of LOOK is better than SSTF. SSTF lags in performance.
2. LOOK results in increased total seek time. It reduces total seek time as compared to LOOK.
3. It provides low variance in average waiting time and response time. This algorithm provides high variance average response time and waiting time.
4. As shown in above example, direction of head gets reversed when it serves the last request in one direction. But here, direction of head plays an important role, in order to break tie between requests.
5. In this algorithm, there is an overhead for finding end request. Here, there is an overhead for finding out closest request.
6. LOOK does not cause starvation to any request. Here, the request which are far from head will suffer starvation.
7. LOOK algorithm can handle requests more effectively than SSTF. Here handling of request is not so good as compared to LOOK algorithm.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.