Difference between FCFS and SSTF Disk Scheduling Algorithm

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

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: 81, 110, 38, 156, 68, 172, 92, 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:

FCFS vs SSTF Disk Scheduling Algorithm

Total head movements,

The initial head point is 45,

= (81-45) + (110-81) + (110-38) + (156-110) + (156-68) + (172-156) + (172-92) + (92-10)

= 36 + 29 + 72 + 46 + 88 + 16 + 80 + 82

= 449

Advantages and Disadvantages of FCFS Disk Scheduling Algorithm

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

Advantages

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

Disadvantages

  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.

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. When 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: 87, 110, 50, 172, 67, 156, 39, 15. 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:

FCFS vs SSTF Disk Scheduling Algorithm

Total head movements,

Initial head point is 45,

= (50-45) + (50-39) + (39-15) + (67-15) + (87-67) + (110-87) + (156-110) + (172-156)

= 5 + 11 + 14 + 52 + 20 + 23 + 46 + 16

= 187

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 waiting time and response time.
  3. The algorithm is slowed by frequent changes in the head's direction.

Main Differences between the FCFS and SSTF Disk Scheduling Algorithm

FCFS vs SSTF Disk Scheduling Algorithm

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

  1. FCFS stands for First Come First Serve. In contrast, the SSTF stands for Shortest Seek Time First.
  2. FCFS disk scheduling algorithm is not efficient in seek movements. In contrast, the SSTF disk scheduling algorithm is very effective in seek movements.
  3. FCFS disk scheduling algorithm gives more average waiting time and response time. In contrast, the SSTF disk scheduling algorithm gives less response time and average waiting time.
  4. FCFS disk scheduling algorithm does not cause starvation to any request. In contrast, the request which is far from the head will suffer starvation in the SSTF algorithm.
  5. FCFS disk scheduling algorithm increases the total seek time than the SSTF. In contrast, the SSTF disk scheduling algorithm reduces the total seek time than the FCFS.
  6. In the FCFS disk scheduling algorithm direction of the head does not matter. In contrast, the SSTF disk scheduling algorithm head's direction plays an important role in breaking a tie between requests.

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

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

FCFS Disk Scheduling AlgorithmSSTF Disk Scheduling Algorithm
FCFS stands for First Come First Serve.SSTF stands for Shortest Seek Time First.
It is not effective in seek movements.It is very effective in seek movements.
It increases the total seek time than the SSTF.It reduces the total seek time than the FCFS.
It gives more response time and average waiting time.It gives less response time and average waiting time.
It doesn't cause starvation to any request.The request which is far from the head will suffer starvation in the SSTF algorithm.
Its head direction doesn't matter, and the head moves in both forward or reversed directions.Its head direction plays an important role in breaking a tie between requests.





Latest Courses