# Difference between C-SCAN and SSTF Disk Scheduling Algorithm

## C-SCAN / Circular Elevator

The circular SCAN (C-SCAN) scheduling method is a modified version of the SCAN disc scheduling technique that addresses the SCAN algorithm's inefficiency by more equitably serving requests. C-SCAN, like the SCAN (lift algorithm), moves the head from one end to the other, fulfilling all requests. However, once the head reaches the other end, it returns to the start of the disk without any requests along the way (see chart below) and starts serving again after reaching the start. The "Circular Elevator Algorithm" is named by the fact that it interprets the cylinders as a circular list that loops around from the last to the first.

Benefits:

• This ensures a consistent wait time.
• This allows for faster response times.
• The head moves from one end of the disk to the other, fulfilling all requests along the way.
• The C-SCAN scheduling method is an upgraded variant of the SCAN algorithm.

Drawback:

• It might not be fair to service requests for tunes on the furthest reaches of the spectrum.
• When compared to the SCAN Algorithm, it has more seek motions.

Example:

Consider a disc with 180 tracks (0-179) and a disc queue with input/output requests in the following order: 75, 90, 40, 135, 50, 170, 65, 10, 75, 90, 40, 135, 50, 170, 65, 10, 75, 90, 40, 135, 50, 170, 65, 10, 75, 90, 40, 135, 50, 170, 65, 10, 75, 90, 40 The Read/Write head's starting position is 45 degrees, and it will travel to the right. Using the C-SCAN method, determine the total number of track movements of the Read/Write head. The starting position for the head is 45 degrees.

= (50-45) + (65-50) + (75-65) + (90-75) + (135-90) + (170-135) + (179-170) + (179-0) + (10-0) + (179-170) + (179-0) + (10-0) + (40-10)

= 15 + 45 + 35 + 9 +179 + 10 + 30 = 5 + 15 + 10 +15 + 45 + 35 + 9 +179 + 10 + 30

= 353

## SSTF Disk Scheduling Algorithm

Shortest Seek Time First (SSTF) is an acronym for "shortest seek time first." This approach fulfils the task request that is closest to the present location of the head or pointer, as the name implies. In this case, the direction of the head is crucial in calculating total head movement. If there is a tie between requests, the head will serve the request that comes first in the order in which it was received. In comparison to C-LOOK, the SSTF algorithm is extremely efficient in terms of overall search time. SSTF scheduling priority is given to processes that have the fewest searches. To do this, the time of each request is calculated in advance in the queue, and then requests are scheduled based on their search time.

Benefits:

• It enhances and expands throughput.
• The overall seek time of the SSTF is less than that of the FCFS.
• It offers a faster response time and a shorter average wait time.

Drawback:

• The significant variation in response time and waiting time is accessible in the SSTF disc scheduling technique.
• Frequent changes in the direction of the head slow down the algorithm.

Example:

To further understand the SSTF Disk Scheduling Algorithm, let's look at an example. Consider a disc with 180 tracks (0-179) and a disc queue with the following input/output requests: 92, 100, 40, 148, 67, 170, 29, ten, ten, ten, ten, ten, ten, ten, ten, ten The Read/Write head's starting position is 45 degrees, and it will shift to the left side. Using the SSTF technique, calculate the total number of track movements for the read/write head. The initial head point is 45 degrees.

= (45-40) + (40-29) + (29-10) + (67-10) + (92-67) + (100-92) + (148-100) + (100-92) + (148-100) + (170-148)

= 5 + 11 + 19 + 57 + 25 + 8 + 48 + 22 = 5 + 11 + 19 + 57 + 25 + 8 + 48 + 22

=195

Major Differences