# Difference Between SSTF and C-LOOK Disk Scheduling Algorithm

In this article, you will learn the difference between the SSTF and C-LOOK disk scheduling algorithm. But before discussing the differences, you need to know about the SSTF and C-LOOK disk scheduling algorithm.

## What is SSTF Disk Scheduling Algorithm?

SSTF stands for Shortest Seek Time First, and it serves the request that is closest to the current position of the head. The direction of the head pointer is quite important in this algorithm. When a tie happens between requests, the head will serve the request in its current direction. In comparison to the FCFS, the SSTF algorithm is very efficient in terms of the total seek time.

Example:

Let's take an example to understand the SSTF Disk Scheduling Algorithm. Let's take a disk with 180 tracks (0-179) and the disk queue having input/output requests in the following order: 78, 64, 35, 169, 95, 147, 13, 115. The initial head position of the Read/Write head is 45 and will move in the left-hand side direction. Find the total number of track movements of the Read/Write head using the SSTF algorithm.

Solution: = (45-35) + (35-13) + (64-13) + (78-64) + (95-78) + (115-95) + (147-115) + (169-147)

= 10 + 22 + 41 + 14 + 17 + 20 + 32 + 22

= 178

1. It improves and increase the throughput.
2. SSTF's total seek time is lower than the FCFS.
3. It has less response time and average waiting time.

1. Starvation can happen for requests far from the head.
2. In the SSTF disk scheduling algorithm, the high variance is available in response time and waiting time.
3. The algorithm is slowed by frequent changes in the head's direction.

## C-LOOK Disk Scheduling Algorithm

It is a combination of the LOOK and SCAN disk scheduling algorithms. In this disk scheduling algorithm, the head begins from the initial request to the last request in the other direction and serves all requests in between. The head jumps in the other direction after finishing the last request at one end and proceeds towards the remaining requests, completing them in the same direction as previously. Unlike LOOK, it only responds to requests in one direction.

Example:

Let's take an example to understand the C-LOOK Disk Scheduling Algorithm. Let's take a disk with 180 tracks (0-179) and the disk queue having input/output requests in the following order: 78, 64, 35, 169, 95, 147, 13, 115. The initial head position of the Read/Write head is 45 and would move on the right-hand side. Find the total number of track movements of the Read/Write head using the C-LOOK disk scheduling algorithm.

Solution: The initial head point is 45,

= (64-45) + (78-64) + (95-78) + (115-95) + (147-115) + (169-147) + (169-13) + (35-13)

= 19 + 14 + 17 + 20 + 32 + 22 + 156 + 22

= 302

1. It provides better performance compared to the LOOK disk scheduling algorithm.
2. The starvation is avoided in the C-LOOK disk scheduling algorithm.
3. If no requests are to be served, the head doesn't have to go all the way to the end of the disk in the C-LOOK disk scheduling algorithm.
4. In C-LOOK, there is minimal waiting time for cylinders that are only visited by the head.
5. Waiting time and response time have a low variance.

1. The overhead of finding the end requests is present in C-LOOK.

## Main Differences between the SSTF and C-LOOK Disk Scheduling Algorithm Here, you will learn the main differences between the SSTF and C-LOOK Disk Scheduling Algorithm. Various differences between the SSTF and C-LOOK Disk Scheduling Algorithm are as follows:

1. SSTF stands for the Shortest Seek Time First. In contrast, C-LOOK is a combination of the LOOK and SCAN disk scheduling algorithms.
2. The SSTF disk scheduling algorithm has a huge variance in response time and average waiting time. In contrast, the C-LOOK disk scheduling gives a low variance in average waiting time and response time.
3. The performance of the SSTF disk scheduling algorithm is lesser than the C-LOOK disk scheduling algorithm. In contrast, the performance of the C-LOOK disk scheduling algorithm is higher than the SSTF disk scheduling algorithm.
4. SSTF disk scheduling algorithm services the request in both directions. In contrast, the C-LOOK disk scheduling algorithm services the request in only one direction.
5. The SSTF disk scheduling algorithm has the burden of finding the closest request. In contrast, the C-LOOK disk scheduling algorithm causes more seek time than the SSTF disk scheduling algorithm.
6. The SSTF disk scheduling algorithm may lead to starvation. In contrast, the C-LOOK disk scheduling algorithm would never cause starvation to any request.

Here, you will learn the head-to-head comparison between the SSTF and C-LOOK Disk Scheduling Algorithm. The main differences between the SSTF and C-LOOK Disk Scheduling Algorithm are as follows:

SSTF Disk Scheduling algorithm C-LOOK Disk Scheduling Algorithm
SSTF stands for the Shortest Seek Time First. It is a combination of the LOOK and SCAN disk scheduling algorithms.
SSTF disk scheduling algorithm services the request in both directions. C-LOOK disk scheduling algorithm services the request in only one direction.
The SSTF disk scheduling algorithm has a huge variance in response time and average waiting time. The C-LOOK disk scheduling gives a low variance in average waiting time and response time.
The performance of the SSTF disk scheduling algorithm is lesser than the C-LOOK disk scheduling algorithm. The performance of the C-LOOK disk scheduling algorithm is higher than the SSTF disk scheduling algorithm.
The SSTF disk scheduling algorithm has the burden of finding the closest request. The C-LOOK disk scheduling algorithm causes more seek time than the SSTF disk scheduling algorithm.
The SSTF disk scheduling algorithm may lead to starvation. The C-LOOK disk scheduling algorithm would never cause starvation to any request.
In the above SSTF algorithm example, the head begins at 45 and analyzes the closest request before moving in that direction. In the above C-LOOK algorithm example, the head moves from 45 and serves all requests in the right direction until it reaches the last request in one end. After that, it moves on to the remaining requests and serves them only in the right direction.

### Feedback   