Home » Difference between C-SCAN and SSTF Disk Scheduling Algorithm

Difference between C-SCAN and SSTF Disk Scheduling Algorithm

by Online Tutorials Library

Difference between C-SCAN and SSTF Disk Scheduling Algorithm

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

What is C-SCAN Disk Scheduling Algorithm?

It is also known as the Circular Elevator algorithm. It is an improved version of the SCAN disk scheduling algorithm. In this algorithm, the head works for requests in a single direction, i.e., it scans all the way to the end of a direction and then jumps to another end and services the requests in the same direction.

Example:

Let’s take a disk with 180 tracks (0-179) and the disk queue having input/output requests in the following order: 75, 90, 40, 135, 50, 170, 65, 10. The initial head position of the Read/Write head is 45 and will move on the right-hand side. Find the total number of track movements of the Read/Write head using the C-SCAN algorithm.

Solution:

Difference between C-SCAN and SSTF Disk Scheduling Algorithm

Total head movements,

The initial head point is 45,

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

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

= 353

Advantages and Disadvantages of C-SCAN Disk Scheduling Algorithm

There are various advantages and disadvantages of the C-SCAN disk scheduling algorithm. These advantages and disadvantages are as follows:

Advantages

  1. It gives a uniform waiting time.
  2. It gives a better response time.
  3. The head travels from one end to the other disks end and serves all requests along the way.
  4. The C-SCAN algorithm is the improved version of the SCAN scheduling algorithm.

Disadvantages

  1. If no requests remain to be serviced, the head will travel to the end of the disk.

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. If 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: 92, 100, 40, 148, 67, 170, 29, 10. 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:

Difference between C-SCAN and SSTF Disk Scheduling Algorithm

Total head movements,

Initial head point is 45,

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

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

= 195

Advantages and Disadvantages of SSTF Disk Scheduling Algorithm

There are various advantages and disadvantages of SSTF Disk Scheduling Algorithm. These advantages and disadvantages are as follows:

Advantages

  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.

Disadvantages

  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.

Main Differences between the C-SCAN and SSTF Disk Scheduling Algorithm

Difference between C-SCAN and SSTF Disk Scheduling Algorithm

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

  1. The C-SCAN algorithm only services the requests in one direction. On the other hand, the SSTF algorithm may handle requests in both directions.
  2. The C-SCAN algorithm has a low variance in average waiting and response time. On the other hand, the SSTF disk scheduling algorithm has a huge variance in response time and average waiting time.
  3. C-SCAN disk scheduling algorithm causes more seek time. On the other hand, the SSTF disk scheduling algorithm has the overhead of finding the closest request.
  4. C-SCAN disk scheduling algorithm would never cause starvation to any requests. In contrast, the SSTF disk scheduling algorithm may cause starvation.
  5. C-SCAN performance is better than the SSTF. In contrast, the SSTF disk scheduling algorithm performance is lesser than the C-SCAN.

Head-to-head Comparison between the C-SCAN and SSTF Disk Scheduling Algorithm

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

C-SCAN Disk Scheduling Algorithm SSTF Disk Scheduling Algorithm
It only services the requests in one direction. It may handle requests in both directions.
It has a low variance in average waiting and response time. It has a huge variance in response time and average waiting time.
It causes more seek time. It has the overhead of finding the closest request.
It would never cause starvation to any requests. It may cause starvation.
Its performance is better than the SSTF. Its performance is lesser than the C-SCAN.

You may also like