# Difference between C-SCAN and SSTF Disk Scheduling Algorithm

1. C-SCAN Disk Scheduling Algorithm :
C-SCAN algorithm, also known as Circular Elevator algorithm is the modified version of SCAN algorithm. In this algorithm, the head pointer starts from one end of disk and moves towards the other end, serving all requests in between. After reaching the other end, the head reverse its direction and go to the starting point. It then satisfies the remaining requests, in same direction as before. Unlike SSTF, it can handle requests only in one 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 `

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-SCAN algorithm.

```= (65-53)+(98-65)+(122-98)+(124-122)+(183-124)
+(199-183)+(199-0)+(10-0)+(40-10)
= 395 ```

2. SSTF Disk Scheduling Algorithm :
SSTF stands for Shortest Seek Time First, as the the name suggests it serves the request which is closest to the current position of head or pointer. In this algorithm, direction of the the head pointer matters a lot. If there occurs a tie between requests, then the head will serve the request in its ongoing direction. Unlike C-SCAN, 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 `

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 ```

Difference between C-SCAN and SSTF Disk Scheduling Algorithm :

S.No. C-SCAN SSTF
1. C-SCAN algorithm services the requests only in one direction. SSTF algorithm can handle the requests in both directions.
2. This algorithm causes more seek time as compared to SSTF. In SSTF algorithm, there is an overhead of finding closest request.
3. Performance of C-SCAN is far better than SSTF. Whereas SSTF lags in performance.
4. C-SCAN algorithm provides low variance in average waiting time and response time. Whereas SSTF provides high variance in average waiting time and response time.
5. C-SCAN algorithm will never cause starvation to any requests. SSTF algorithm can cause starvation.

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.