The Wayback Machine - https://web.archive.org/web/20240927005314/https://www.geeksforgeeks.org/difference-between-scan-and-cscan-disk-scheduling-algorithms/
Open In App

Difference Between SCAN and CSCAN Disk Scheduling Algorithms

Last Updated : 18 Sep, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

The disk scheduling algorithm is a technique operating systems use to manage the order in which disk I/O (input/output) requests are processed. Disk scheduling is also known as I/O Scheduling. The main goals of disk scheduling are to optimize the performance of disk operations, reduce the time it takes to access data, and improve overall system efficiency.

What is the SCAN Disk Scheduling Algorithm?

SCAN Disk Scheduling Algorithm is also known as Elevator algorithm. In this, the head or pointer can move in both directions i.e., the disk arm starts to move from one end of the disk to the other end servicing all the requests until it reaches the other end of the disk. After reaching the other end, the head movement direction is reversed and further continues servicing the requests. The problem is that it takes longer waiting time than the C-SCAN scheduling algorithm for requesting the locations.

Advantages of SCAN Algorithm

  • This algorithm is simple and easy to understand.
  • SCAN algorithm has no starvation.
  • This algorithm is better than the FCFS Disk Scheduling algorithm.
  • It reduces the overall movement of the disk arm.

Disadvantages of the SCAN Algorithm

  • More complex algorithm to implement.
  • Long waiting time for requests at the ends.
  • This algorithm is not fair because it causes a long waiting time for the cylinders just visited by the head.

Example :

Assuming the head starts at 53 and starts moving towards left end.

Step-by-step Explanation

Step 1. Moving from 53 to 37: Since the head starts at 53 and moves left, the first request it encounters is at 37. Distance traveled: 53 – 37 = 16.

Step 2. Moving from 37 to 14: The next request is at 14, as the head continues moving left. Distance traveled: 37 – 14 = 23.

Step 3. Moving from 14 to 0: Continuing left, the next request is at the leftmost position, 0. Distance traveled: 14 – 0 = 14.

Step 4. Reversing direction and moving from 0 to 65: Now, the head reverses direction and starts moving right. The next request is at 65, the first request it encounters while moving right. Distance traveled: 65 – 0 = 65.

Step 5. Moving from 65 to 67: The next request is at 67, which is close to 65. Distance traveled: 67 – 65 = 2.

Step 6. Moving from 67 to 98: The next request is at 98, farther to the right. Distance traveled: 98 – 67 = 31.

Step 7. Moving from 98 to 122: The next request is at 122. Distance traveled: 122 – 98 = 24.

Step 8. Moving from 122 to 124: The next request is at 124. Distance traveled: 124 – 122 = 2.

Step 9. Moving from 124 to 183: The final request is at 183. Distance traveled: 183 – 124 = 59.

Total Distance Traveled

Calculate the total distance traveled by summing the individual distances:

(53−37)+(37−14)+(14−0)+(65−0)+(67−65)+(98−67)+(122−98)+(124−122)+(183−124)
16+23+14+65+2+31+24+2+59=236

What is C-SCAN Disk Scheduling Algorithm?

In C-SCAN disk scheduling algorithm, the only difference with respect to SCAN algorithm is that, it is designed to provide more uniformity in waiting time. In this, head or pointer works in a single direction i.e., it scans for the requests all the way to a direction and once it reaches the end, it jumps back to another end and services the requests in the same direction unlike, SCAN does it in both reversed and forward direction.

Advantages of C-SCAN Disk Scheduling Algorithm

  • Works well with moderate to heavy loads.
  • It provides more uniform wait times across all tracks since it always moves in one direction.
  • It provides better response time and uniform waiting time.
  • It doesn’t reverse direction, resulting in smoother performance.

Disadvantages of C-SCAN Disk Scheduling Algorithm

  • May not be fair to service requests for tracks at the extreme end.
  • Increased seek time for some requests.
  • It has more seek movements as compared to the SCAN Algorithm.

Example:

Assuming the head starts at 53 and starts moving towards right end.

Step-by-step Explanation

Step 1. Moving from 53 to 65: The head starts at 53 and moves towards the right. The first request it encounters is at 65. Distance traveled: 65 – 53 = 12.

Step 2. Moving from 65 to 67: The next request is at 67. Distance traveled: 67 – 65 = 2.

Step 3. Moving from 67 to 98: The next request is at 98. Distance traveled: 98 – 67 = 31.

Step 4. Moving from 98 to 122: The next request is at 122. Distance traveled: 122 – 98 = 24.

Step 5. Moving from 122 to 124: The next request is at 124. Distance traveled: 124 – 122 = 2.

Step 6. Moving from 124 to 183: The next request is at 183. Distance traveled: 183 – 124 = 59.

Step 7. Moving from 183 to 199 (end of the disk): The final request before the head reaches the end is at 199. Distance traveled: 199 – 183 = 16.

Step 8. Jumping from 199 to 0 (wrap-around, no requests serviced): The head jumps to the start of the disk at 0 without servicing any requests during the jump. Distance traveled: 199 – 0 = 199.

Step 9. Moving from 0 to 14: After wrapping around to 0, the head starts moving right again and services the request at 14. Distance traveled: 14 – 0 = 14.

Step 10. Moving from 14 to 37: The next request is at 37. Distance traveled: 37 – 14 = 23.

Total Distance Traveled

Calculate the total distance traveled by summing the individual distances:

(65−53)+(67−65)+(98−67)+(122−98)+(124−122)+(183−124)+(199−183)+(199−0)+(14−0)+(37−14)
12+2+31+24+2+59+16+199+14+23=382

Difference Between SCAN and C-SCAN disk scheduling algorithm

Below the difference between SCAN and C-SCAN disk scheduling algorithm:

SCAN Scheduling Algorithm C-SCAN Scheduling Algorithm
It is also known as Elevator Algorithm. It is also known as Circular Elevator Algorithm.
It services all the requests in both the direction. It services the requests in one direction only.
In above example of SCAN algorithm, head starts moving from 53 towards left servicing all the requests in that direction and further, reaching at left end, it changes the head direction to right and further servicing all the requests from 0 to 199. In above example of C-SCAN algorithm, head starts from 53 toward right servicing all the requests in that direction and after reaching at right end it does not reverses its direction rather, head jumps to the opposite end of the disk servicing the requests on its right.
SCAN Algorithm provides a longer waiting time to request the locations. C-SCAN Algorithm provides uniform waiting time in requesting the locations over Elevator Algorithm.
It has higher throughput and provides low variance response time. This algorithm provides better response time.

Less fair to requests far from the center.

More fair with respect to uniform wait times.

Slightly less complex than CSCAN.

Slightly more complex due to circular nature.

Conclusion

SCAN and CSCAN disk scheduling algorithms both are improve the efficiency of disk scheduling algorithm by reducing seek time and managing disk arm movements efficiently. SCAN disk scheduling algorithm is more suited to environments, while CSCAN disk scheduling algorithm provides more appropriateness and uniform wait times, mainly for requests at the start the disk and end of the disk.

Difference Between SCAN and CSCAN Disk Scheduling Algorithms – FAQs

When should SCAN be preferred over CSCAN?

SCAN is preferred in environments where the workload is heavy and uniformly distributed across the disk, and the overhead of direction reversal is acceptable.

Which algorithm provides lower seek times?

SCAN generally provides lower seek times on average, but CSCAN can provide better performance in cases where appropriateness and uniform wait times are critical.

Does CSCAN eliminate the overhead of reversing the disk arm’s direction?

Yes, CSCAN algorithm avoids the overhead of reversing the disk arm by always moving in one direction and wrapping around to the start.

Why is CSCAN more uniform in terms of request handling?

Since CSCAN disk scheduling algorithm always moves in one direction and wraps around to the beginning, it avoids the issue of biasing requests toward the center, providing more uniform service.



Similar Reads

Difference between SCAN and LOOK Disk scheduling algorithms
SCAN disk scheduling algorithm: In SCAN disk scheduling algorithm, head starts from one end of the disk and moves towards the other end, servicing requests in between one by one and reach the other end. Then the direction of the head is reversed and the process continues as head continuously scan back and forth to access the disk. So, this algorith
4 min read
Difference between FCFS and SCAN disk scheduling algorithms
FCFS disk scheduling algorithm: As the name suggests, the FCFS Scheduling Algorithm processes requests in the sequential order in which they arrive in the disk queue. Even if a higher priority request arrives in the schedule later, FCFS will process the request in the order that they have arrived and hence we can say that FCFS has a fair policy. Ex
3 min read
SCAN (Elevator) Disk Scheduling Algorithms
In the SCAN Disk Scheduling Algorithm, the head starts from one end of the disk and moves towards the other end, servicing requests in between one by one and reaching the other end. Then the direction of the head is reversed and the process continues as the head continuously scans back and forth to access the disk. In this article, we will look int
12 min read
Difference between C-LOOK and C-SCAN Disk Scheduling Algorithm
C-LOOK Disk Scheduling Algorithm C-LOOK is the modified version of both LOOK and C-scan algorithms. In this algorithm, the head starts from the first request in one direction and moves towards the last request at another end, serving all request in between. After reaching the last request in one end, the head jumps in another direction and move tow
3 min read
Difference between FCFS and C-SCAN disk scheduling algorithm
1. FCFS Disk Scheduling Algorithm : FCFS stands for First come first serve, this algorithm entertains the task in the order they arrived in the disk queue. It is the simplest and easy to understand disk scheduling algorithm. In this the head or pointer moves in the direction in which the task arrives and moves till all request is served. However, F
3 min read
Difference Between C-SCAN and SSTF Disk Scheduling Algorithm
In C-SCAN Algorithm it is necessary to take into account the direction, i.e., larger or smaller value. This algorithm serves disk requests by moving towards their conclusion while SSTF is a secondary storage scheduling method that decides how the disk's head and arm will move to fulfil read and write requests. In this article, you will discover the
5 min read
Difference between Seek Time and Disk Access Time in Disk Scheduling
Seek Time: A disk is divided into many circular tracks. Seek Time is defined as the time required by the read/write head to move from one track to another. Example, Consider the following diagram, the read/write head is currently on track 1. Now, on the next read/write request, we may want to read data from Track 4, in this case, our read/write hea
3 min read
Difference between Transfer Time and Disk Access Time in Disk Scheduling
1. Transfer Time : Time required to transfer the required amount of data. It can be calculated by the given formula Transfer time, = Data to be transfer / transfer rate Data to be transfer is given in the question and transfer rate is sometimes given and sometimes it may not be given. It can be calculated by the given formula. Transfer Rate, = {(Nu
2 min read
Difference between Rotational Latency and Disk Access Time in Disk Scheduling
1. Rotational Latency : Rotational Latency is also known as Rotational time. The amount of time taken by the disk to rotate the track when the read/write head come to exact sector or we can also say that the time taken by the desired sector to come under the read/write head is called rotational latency. Rotational Latency is depends on the rotation
4 min read
N-Step-SCAN disk scheduling
The input-output requests that are coming from the disk are scheduled by the operating system and that scheduling of the disk is known as disk scheduling. Disk scheduling is important since multiple requests come from processes for disk but only one disk is assigned to process at a time. Seek time is one of the crucial parameters in the operating s
5 min read
C-SCAN Disk Scheduling Algorithm
Given an array of disk track numbers and initial head position, our task is to find the total number of seek operations to access all the requested tracks if a C-SCAN Disk Scheduling algorithm is used. The Circular SCAN (C-SCAN) Scheduling Algorithm is a modified version of the SCAN Disk Scheduling Algorithm that deals with the inefficiency of the
12 min read
Difference between Interlaced Scan and Progressive Scan
Interlaced Scan and Progressive Scan are the formation scanning technique wide employed in analog video system. Interlaced Scanning: Interlaced Scanning takes place over dividing one frame. In interlaced scan, the displaying video speed is lesser than progressive scan. In interlaced scan, the video quality is vulgarized and there is present the com
2 min read
Difference between Raster Scan and Random Scan
Raster Scan associates degreed, random scan square measure the mechanisms employed in displays for rendering the image or picture. The most distinction between formation scan and random scan lies within the drawing of an image wherever the formation scan points the nonparticulate radiation at the whole screen however incorporating only one line at
2 min read
Difference between LOOK and C-LOOK Disk scheduling algorithms
1. LOOK disk scheduling algorithm : Look Algorithm is actually an improves version of SCAN Algorithm. In this algorithm, the head starts from first request at one side of disk and moves towards the other end by serving all requests in between. After reaching the last request of one end, the head reverse its direction and returns to first request, s
3 min read
Difference between Magnetic Disk and Optical Disk
The magnetic and optical disks are the storage devices that provide a way to store data for a long duration. Both are categorized as secondary storage devices. In this article, we are going to discuss the Difference between Magnetic Disks and Optical disks in detail. What is a Magnetic Disk?A magnetic disk is a storage device that uses a magnetizat
4 min read
Difference between Hard Disk and Floppy Disk
In computer two prominent types of storage devices that have been widely used are hard disk and floppy disk. A hard disk is a high-capacity, durable storage device that uses magnetic disks to store data, offering faster access and larger storage compared to a floppy disk, Where as Floppy disks are portable, low-capacity storage devices that were po
5 min read
Difference Between Basic Disk and Dynamic Disk
When managing storage in Windows operating systems, you might come across two primary kinds of disk configurations: Basic Disk and Dynamic Disk. To do this well and make sure that your data is organized according to your needs, it becomes important to know the differentiation between these disk types. This article will explore the main features and
6 min read
Advantages and Disadvantages of various Disk scheduling algorithms
Prerequisite - Disk Scheduling Algorithms 1. First Come First Serve (FCFS) : Advantages - First Come First Serve algorithm has a very simple logic, it executes the process requests one by one in the sequence they arrive. Thus, First Come First Serve is very simple and easy to understand and implement. In FCFS eventually, each and every process gets
3 min read
FCFS Disk Scheduling Algorithms
Prerequisite: Disk scheduling algorithms.Given an array of disk track numbers and initial head position, our task is to find the total number of seek operations done to access all the requested tracks if First Come First Serve (FCFS) disk scheduling algorithm is used. First Come First Serve (FCFS) FCFS is the simplest disk scheduling algorithm. As
6 min read
Disk Scheduling Algorithms
Disk scheduling is a technique operating systems use to manage the order in which disk I/O (input/output) requests are processed. Disk scheduling is also known as I/O Scheduling. The main goals of disk scheduling are to optimize the performance of disk operations, reduce the time it takes to access data and improve overall system efficiency. In thi
12 min read
Difference between Rotational Latency and Transfer Time in Disk Scheduling
1. Rotational Latency: Rotational Latency is the amount of time it takes for the desired sector of a to rotate under the read-write heads of the disk drive. In other words, the disk is divided into many circular tracks, and these tracks are further divided into blocks knows as sectors. So Rotational Latency is the time required by the read/write he
2 min read
Difference between FCFS and SSTF Disk Scheduling Algorithm
Prerequisite - Disk Scheduling Algorithms 1. FCFS Disk Scheduling Algorithm : First come first serve, as name suggest this algorithm entertains the task in the order they arrived in the disk queue. It is the simplest and easy to understand disk scheduling algorithm. In this the head or pointer moves in the direction in which the task arrives and mo
3 min read
Difference between SSTF and LOOK disk scheduling algorithm
1. SSTF disk scheduling algorithm : SSTF stands for Shortest Seek Time First. As the name specify, this algorithm serves the task request which is closest to current position of head or pointer. Here, the direction of head plays an vital role in determining total head movement. If there occurs a tie between requests then the head will serve the req
3 min read
Difference between FCFS and C-LOOK disk scheduling algorithm
1. FCFS Disk Scheduling Algorithm FCFS stands for First Come First Serve, this algorithm entertains the task in the order they arrived in the disk queue. It is the simplest and easy to understand disk scheduling algorithm. In this, the head or pointer moves in the direction in which the task arrives and moves till all request is served. However, th
3 min read
Difference Between SSTF and C-LOOK Disk Scheduling Algorithm
The secondary storage scheduling algorithm known as SSTF decides how the disk's head and arm will move in response to read and write requests while in C-SCAN the head services request only in one direction(either left or right) until all the requests in this direction are not serviced and then jumps back to the farthest request in the other directi
7 min read
Difference Between Seek Time and Transfer Time in Disk Scheduling
The head's seek time is the time it takes to move from the current track to the one containing the data. The amount of time needed to move data from the disc to the host system is called the transfer time. In hard drives, a head is present which is supposed to write or read from the magnetic disk. In this article we are going to discuss what are se
4 min read
Difference between Seek Time and Rotational Latency in Disk Scheduling
Disk management is essential for data storage, retrieval of data and backup the data. To store the data in the disk some I/O operations like read/write are needed. The operating system uses disk scheduling techniques which can be used to schedule I/O requests arriving to the disk. This disk scheduling techniques uses some measurements to improve th
4 min read
SCAN - EDF Scheduling in OS
SCAN-EDF is a disk scheduling algorithm that is the same as the EDF algorithm but utilizes the seek optimization technique of the 'SCAN' algorithm when similar deadlines occur. It is a hybrid algorithm. To understand the importance of this algorithm, let us first look at the drawbacks of strictly following the Earliest Deadline First (EDF) algorith
4 min read
Difference between Priority Scheduling and Round Robin (RR) CPU scheduling
1. Priority Scheduling Algorithm : Priority scheduling algorithm executes the processes depending upon their priority. Each process is allocated a priority and the process with the highest priority is executed first. Priorities can be defined internally as well as externally. Internal priorities are decided by the system depending upon the number o
3 min read
Difference between Priority scheduling and Shortest Job First (SJF) CPU scheduling
1. Priority Scheduling Algorithm : Priority scheduling algorithm executes the processes depending upon their priority. Each process is allocated a priority and the process with the highest priority is executed first. Priorities can be defined internally as well as externally. Internal priorities are decided by the system depending upon the number o
3 min read