Table of contents
1.
Introduction
2.
Scan Disk Scheduling Algorithm
2.1.
Advantages of Scan Disk Scheduling Algorithm
2.2.
Disadvantages of Scan Disk Scheduling Algorithm
3.
C-Scan Disk Scheduling Algorithm
3.1.
Advantages of C-Scan Disk Scheduling Algorithm
3.2.
Disadvantages of Scan Disk Scheduling Algorithm
4.
Differences between SCAN And C-SCAN Disk Scheduling Algorithm
5.
Comparison between the SCAN and C-SCAN Disk Scheduling Algorithm
6.
Frequently Asked Questions
6.1.
How many types of Disc Scheduling are there?
6.2.
Does C-SCAN cause starvation?
6.3.
Which is better SCAN or C-SCAN?
6.4.
Which policy restricts scanning to one direction only?
6.5.
What is the difference between SCAN and Clook?
6.6.
What are the advantages of C-SCAN over the traditional SCAN algorithm?
7.
Conclusion
Last Updated: Apr 21, 2024
Easy

SCAN Vs C-SCAN DISK SCHEDULING

Author Ankit Kumar
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

This article will discuss the differences between the SCAN and C-SCAN Disk Scheduling Algorithms. But, before we move further to get into the differences, it's essential to understand the SCAN and C-SCAN Disk Scheduling Algorithms. And for a better understanding, we must first understand Disc Scheduling before moving on to SCAN and C-SCAN.

Operating Systems

So basically, Disk Scheduling is a process that sends input/output requests to the operating system for the Operating System to access the disc. The Disk Scheduling Algorithm controls these requests and determines the sequence they are granting disc access.

In the next section, we’ll learn about Scan Disk Scheduling Algorithms.

Also see, Disk Management in Operating Systems, Multiprogramming vs Multitasking

Scan Disk Scheduling Algorithm

The head can move in both directions with this method. This means the disk arm starts moving from one end of the disk to the other end and processing all requests until the disc reaches the other end. The head position is changed when reaching the other end, and the requests are processed again until the disc is full. The Elevator algorithm is another name for the Scan Disk Scheduling Algorithm. and this is because it works in a similar way as an elevator.

 

Let's look at an example to assist us in understanding this concept.

Example:- 

Consider a disc with 200 tracks (0-199) and a disc queue with the following input/output requests: 75, 90, 40, 135, 50, 170, 65, 10. The Read/Write head's initial position is 46, and it will move to the left-hand side. Using the SCAN method, determine the total number of track movements of the Read/Write head.

Solution:

SCAN
Total head movements,
The initial head point is 46,
= (46-40) + (40-10) + (10-0) + (50-0) + (65-50) + (75-65) + (90-75) + (135-90) + (170-135)
= 6+30+10+50+15+10+15+45+35
= 216

 

In the next section, we'll learn the advantages of the Scan Disk Scheduling Algorithm.

Advantages of Scan Disk Scheduling Algorithm

The advantages of the Scan Disk Scheduling Algorithm are as follows:-

  • It's straightforward, and easy to understand and implement.
  • The waiting time and reaction time have a minimal variance.
  • In this disc scheduling approach, starvation is prevented.

 

Let's move to the next section to understand the disadvantages of the Scan Disk Scheduling Algorithm.

Disadvantages of Scan Disk Scheduling Algorithm

The disadvantages of the Scan Disk Scheduling Algorithm are as follows:-

  • As a result, the cylinders that the head has just visited will have to wait a long time.
  • The head will move to the end of the disc if there are no more requests to service.

 

We'll learn about the C-Scan Disk Scheduling Algorithm in the next section.

Before going to C-scan you can learn about Parallel Operating System here. 

C-Scan Disk Scheduling Algorithm

The Circular SCAN (C-SCAN) scheduling method is a modified version of the Scan disc scheduling technique that improves the Scan algorithm's performance by more uniformly processing requests. Like the Scan Algorithm, C-SCAN moves the head from one end to the other, processing all requests.

In this algorithm, the head or pointer only moves in one direction, which means the Scan searches for requests at the end of a direction and then jumps to another end to service the requests in the same direction.

 

Let's look at an example to assist us in understanding this concept.

Example:- 

Consider a disc with 200 tracks (0-199) and a disc queue with the following input/output requests: 75, 90, 40, 135, 170, 65, 10, 45. The Read/Write head's initial position is 55, and it will move to the right-hand side. Using the C-SCAN method, determine the total number of track movements of the Read/Write head.

Solution:

C-SCAN

                                            

Total head movements,
The initial head point is 55,
= (65-55)+(75-65)+(90-75)+(135-90)+(170-135)+(199-170)+(199-0)+(10-0)+(40-10)+(50-40)
= 10+10+15+45+35+29+199+10+30+10
= 393

 

In the next section, we’ll learn the advantages of the C-Scan Disk Scheduling Algorithm.

Advantages of C-Scan Disk Scheduling Algorithm

The advantages of the C-Scan Disk Scheduling Algorithm are as follows:-

  • It allows for a faster response time.
  • The C-Scan scheduling algorithm is an enhanced version of the Scan algorithm.
  • It ensures a consistent waiting time.
  • The head moves from one end of the disc to the other, satisfying all requests.
  • Compared to the Scan Algorithm, the waiting time for the cylinders just visited by the head decreases.

 

In the next section, we'll learn the disadvantages of the Scan Disk Scheduling Algorithm.

Disadvantages of Scan Disk Scheduling Algorithm

The disadvantages of the C-Scan Disk Scheduling Algorithm are as follows:-

  • Compared to the Scan algorithm, it generates more search movements.
  • The head will move to the end of the disc if there are no more requests to service.

 

In the next section, we’ll see the differences between Scan & C-Scan Disk Scheduling Algorithm.

You can also read about the Multilevel Queue Scheduling And Open Source Operating System

Differences between SCAN And C-SCAN Disk Scheduling Algorithm

Let us discuss the differences between SCAN And C-SCAN Disk Scheduling Algorithm.

Particulars

SCAN Disk Scheduling Algorithm

C-SCAN Disk Scheduling Algorithm

Definition Scan Disk Scheduling Algorithm is also known as the Elevator algorithm because the disc arm works like an elevator in a building, fulfilling all requests as it goes up and then all requests as it goes down. C-Scan Disk Scheduling Algorithm is also known as the Circular Elevator algorithm because the algorithm treats the disk cylinder as a circular list.
Wait time The algorithm allows for a longer wait time before requesting a location. The algorithm gives a uniform waiting time while seeking locations.
Directions It handles all requests in both forward and backward directions. It only answers one type of request at a time.
Performance It has faster performance and a reduced reaction time variance. It allows for a faster response time.
Head movement The head in the SCAN algorithm proceeds from 46 to the left, All requests will be processed in that direction until it reaches the left end, then it moves to the right end, processing all requests from 0 to 199. The head in the C-SCAN algorithm travels from 55 to the right-hand side and serves all requests until it reaches the right end, at which point it does not reverse direction but jumps to the other end of the disc and serves the requests on its right end.

In the next section, we'll discuss some frequently asked questions related to the topic.

Comparison between the SCAN and C-SCAN Disk Scheduling Algorithm

Feature SCAN Disk Scheduling Algorithm C-SCAN Disk Scheduling Algorithm
Operation The disk arm scans across the disk surface in a linear fashion, servicing requests in its path until it reaches the end, then reverses direction and scans back. Similar to SCAN, but after reaching the end of the disk, the arm returns to the beginning without servicing requests, ensuring that requests on the other end of the disk are not delayed indefinitely.
Algorithm Name Also known as the Elevator algorithm, as the arm behaves like an elevator in a building, servicing requests in a similar manner. Also known as the Circular Elevator algorithm, as it treats the disk cylinder as a circular list, avoiding potential delays for requests on the opposite end of the disk.
Handling Requests Handles requests in both forward and backward directions. Only handles requests in one direction, preventing potential delays for requests on the opposite end of the disk.
Wait Time May result in longer wait times for requests at the opposite end of the disk, especially if there is a continuous stream of requests in one direction. Provides a more uniform waiting time for requests, as it avoids delaying requests on the opposite end of the disk.
Performance Can exhibit faster performance and reduced variance in response time compared to other algorithms due to its efficient handling of requests. Offers improved performance and predictable response times, particularly for systems with mixed workloads or high request rates.
Head Movement The disk arm moves in both directions across the disk surface, potentially leading to more frequent direction changes and longer seek times. The arm moves in one direction across the disk surface and returns to the beginning without servicing requests, reducing seek times and avoiding indefinite delays for requests.
Implementation Complexity Moderate complexity, as it requires tracking the direction of movement and efficiently handling requests in both directions. Moderate complexity, similar to SCAN, but with additional logic to ensure the arm returns to the beginning of the disk without servicing requests.
Application Suitable for systems with balanced workloads or a mix of read/write requests in both directions. Ideal for systems where requests are predominantly in one direction, preventing potential delays for requests on the opposite end of the disk.

Frequently Asked Questions

How many types of Disc Scheduling are there?

There are six types of disc scheduling algorithms:

  • FCFS scheduling algorithm.
  • SSTF (shortest seek time first) algorithm. 
  • SCAN scheduling. 
  • C-SCAN scheduling. 
  • LOOK Scheduling. 
  • C-LOOK scheduling.

Does C-SCAN cause starvation?

The C-SCAN algorithm will never starve any requests for resources.

Which is better SCAN or C-SCAN?

SCAN has higher efficiency and a lower variance response time than other methods. On the other hand, the C-SCAN algorithm has a faster response time.

Which policy restricts scanning to one direction only?

The C-SCAN policy restricts scanning to one direction only.

What is the difference between SCAN and Clook?

SCAN scans across the disk surface in both directions, while C-LOOK only scans in one direction, avoiding indefinite delays.

What are the advantages of C-SCAN over the traditional SCAN algorithm?

The SCAN Algorithm provides for a longer wait time while requesting locations. Over the Elevator Algorithm, the C-SCAN Algorithm gives uniform waiting time while requesting locations.

Conclusion

In this article, we have extensively discussed the main Differences between SCAN and C-SACN Disk Scheduling Algorithm. We have learned SCAN and C-SCAN Disk Scheduling Algorithm with the help of examples and also some faqs related to this topic.

Recommended Reading:

Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, Uber, Microsoft, etc. on Coding Ninjas Studio.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, DBMS, System Design, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.

Nevertheless, you may consider our paid courses to give your career an edge over others!

Do upvote our blogs if you find them helpful and engaging!

Happy Learning!

Live masterclass