Prerequisite – Disk Scheduling Algorithms
1. SCAN Disk Scheduling Algorithm :
SCAN Disk Scheduling Algorithm is also known as Elevator algorithm. In this, head or pointer can move in both the direction i.e., disk arm starts to move from one end of the disk to the other end servicing all the requests until it reaches to the other end of the disk. After reaching the other end, head movement direction is reversed and further continues servicing the requests.
The problem with this is that it takes longer waiting time than the C-SCAN scheduling algorithm for requesting the locations.
Assuming the head starts at 53 and starts moving towards left end.
Total head movements,
= (53-37)+(37-14)+(14-0)+(65-0)+(67-65) +(98-67)+(122-98)+(124-122)+(183-124) = 236
2. 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.
Assuming the head starts at 53 and starts moving towards right end.
Total head movements,
= (65-53)+(67-65)+(98-67)+(122-98)+(124-122) +(183-124)+(199-183)+(199-0)+(14-0)+(37-14) = 382
Let’s see the difference between SCAN and C-SCAN disk scheduling algorithm –
|S. No.||SCAN Scheduling Algorithm||C-SCAN Scheduling Algorithm|
|1.||It is also known as Elevator Algorithm.||It is also known as Circular Elevator Algorithm.|
|2.||It services all the requests in both the direction.||It services the requests in one direction only.|
|3.||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.|
|4.||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.|
|5.||It has higher throughput and provides low variance response time.||This algorithm provides better response time.|
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.