# Difference between SSTF and C-LOOK disk scheduling algorithm

• Last Updated : 04 Sep, 2020

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 the 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. Unlike C-LOOK, 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 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. C-LOOK Disk Scheduling Algorithm :
C-LOOK is the modified version of both LOOK and SCAN algorithms. In this algorithm, the head starts from first request in one direction and moves towards the last request at other end, serving all request in between. After reaching last request in one end, the head jumps in other direction and move towards the remaining requests and then satisfies them in same direction as before. Unlike SSTF, it doesn’t serves the task request which is closest to the 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 C-LOOK algorithm.

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

Difference between SSTF and C-LOOK disk scheduling algorithm :

S.No. SSTF DISK SCHEDULING ALGORITHM C-LOOK DISK SCHEDULING ALGORITHM
1 SSTF algorithm can manipulate the requests in both directions. Whereas, C-LOOK algorithm services the requests only in one direction.
2 In SSTF algorithm there is an burden of finding closest request. Here, this algorithm causes more seek time as compared to SSTF.
3 SSTF algorithm lags in performance. But, the performance of C-LOOK is far better than SSTF.
4 In above example of SSTF algorithm, the head starts from 53 and analyse the request which is closest to it and hence moves in that direction. In above example of C-LOOK algorithm, the head moves from 53, serves all requests in right direction till it reaches the last request in one end. Then it jumps to the remaining requests and serve them in right direction only.
5 SSTF algorithm can leads to starvation. C-LOOK algorithm will never cause starvation to any requests.
6 SSTF provides high variance in average waiting time and response time. Whereas C-LOOK algorithm provides low variance in average waiting time and response time.

My Personal Notes arrow_drop_up
Recommended Articles
Page :