# Difference between SCAN and FCFS Disk Scheduling Algorithm

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

## What is SCAN Disk Scheduling Algorithm?

It is also known as the Elevator algorithm. In this algorithm, the head may move in both directions, i.e., the disk arm begins to move from one end of the disk to the other end and servicing all requests until it reaches the other end of the disk. After reaching the other end, the head position direction is changed and further continues servicing the requests till the end of the disk.

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 left-hand side. Find the total number of track movements of the Read/Write head using the SCAN algorithm.

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

= 5 + 30 +10 +50 +15 + 10 +15 + 45 + 35

= 215

1. It is easy to use and understand.
2. In the SCAN disk scheduling algorithm, low variance happens in the waiting time and response time.
3. The starvation is avoided.

1. If no requests remain to be serviced, the head moves till the end of the disk.

## What is FCFS Disk Scheduling Algorithm?

FCFS stands for First-Come-First-Serve. It is a very easy algorithm among the all-disk scheduling algorithms. It is an OS disk scheduling algorithm that runs the queued requests and processes in the way that they arrive in the disk queue. It is a very easy and simple CPU scheduling algorithm. In this scheduling algorithm, the process which requests the processor first receives the processor allocation first. It is managed with a FIFO queue.

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. Find the total number of track movements of the Read/Write head using the FCFS algorithm.

Solution: The initial head point is 45,

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

= 30 + 15 + 50 + 95 + 85 + 120 + 105 + 55

= 555

1. It is the very easy type of disk scheduling algorithm.
2. It is easy to program.
3. It provides first come first served process.
4. In FCFS, each process eventually has a chance to execute, therefore there is no starvation.

1. It is not very efficient because of its simplicity.
2. Its average waiting time is high.
3. It is a Non-Preemptive CPU Scheduling Algorithm, which implies that once a process has been assigned to a CPU, it would never release the CPU until the process has completed executing.

## Main Differences between the SCAN and FCFS Disk Scheduling Algorithm Here, you will learn the main differences between the SCAN and FCFS Disk Scheduling Algorithm. Various differences between the SCAN and FCFS Disk Scheduling Algorithm are as follows:

1. SCAN Disk Scheduling Algorithm is also known as Elevator algorithm. In contrast, FCFS stands for First-Come-First-Serve.
2. The SCAN Scheduling Algorithm processes requests in one direction until it reaches the disk's end, and then the disk arm changes direction and begins servicing requests in the opposite order. In contrast, the FCFS will process the requests in the manner that they arrive in the disk queue.
3. The SCAN algorithm has a better algorithm than the FCFS scheduling algorithm in terms of throughput. In contrast, the FCFS algorithm has the lowest throughput among all disk scheduling techniques.
4. The SCAN may occur that the disk arm accessed the request's location, so the request would take a long waiting time to complete. In contrast, the FCFS algorithm has a fair policy in that requests are processed according to schedule.
5. The average seeks time of the SCAN algorithm is much lower in comparison to the FCFS scheduling algorithm. In contrast, the FCFS scheduling algorithms average seek time is the highest among all the disk scheduling algorithms as it doesn't optimize the seek time.

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

SCAN Disk Scheduling Algorithm FCFS Disk Scheduling Algorithm
It is also known as the Elevator algorithm. FCFS stands for First-Come-First-Serve.
It has a better throughput than the FCFS scheduling algorithm. It has the lowest throughput among all disk scheduling algorithms.
It processes requests in one direction until it reaches the disk's end, and then the disk arm changes direction and begins servicing requests in the opposite order. It will process the requests in the manner that they arrive in the disk queue.
Its average seeks time is much lower in comparison to the FCFS scheduling algorithm. The FCFS scheduling algorithms average seek time is the highest among all the disk scheduling algorithms as it doesn't optimize the seek time.
The SCAN may occur that the disk arm accessed the request's location, so the request would take a long waiting time to complete. It has a fair policy in that requests are processed according to schedule.

### Feedback   