Open In App

Difference between FCFS and SSTF Disk Scheduling Algorithm

Last Updated : 01 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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 moves till all request is served. FCFS provides more average waiting time and response time. However, FCFS algorithm has more fair policy of handling upcoming requests. 

Example: Consider a disk with 200 tracks (0-199) and the disk queue having I/O requests in the following order as follows:

98, 183, 40, 122, 10, 124, 65 

The current head position of the Read\Write head is 53. Calculate the total number of track movements of Read/Write head using FCFS algorithm. Total head movements,

= (98-53)+(183-98)+(183-40)+(122-40)+(122-10)+(124-10)+(124-65)
= 640

2. SSTF Disk Scheduling Algorithm : SSTF stands for Shortest Seek Time First, as the name suggests it serves the request which is closest to the current position of head or pointer. In this algorithm direction of  the head pointer matters a lot. If somehow, we encounter a tie between requests then the head will serve the request in its ongoing direction. SSTF algorithm is very efficient in seek time as compared to FCFS. 

Example: Consider a disk with 200 tracks (0-199) and the disk queue having I/O requests in the following order as follows:

98, 183, 40, 122, 10, 124, 65 

The current head position of the Read\Write head is 53 and will move in Right direction. Calculate the total number of track movements of Read/Write head using SSTF algorithm. Total head movements,

= (65-53)+(65-40)+(40-10)+(98-10)+(122-98)+(124-122)+(183-124)
= 240

Difference between FCFS and SSTF disk scheduling algorithm :

  FCFS SCHEDULING ALGORITHM SSTF SCHEDULING ALGORITHM
1. FCFS is not efficient in seek movements. SSTF is very effective/efficient in seek movements.
2. It results in increased total seek time. It reduces the total seek time as compared to FCFS.
3. It provides more average waiting time and response time. This algorithm provides less average response time and waiting time.
4. In this algorithm direction of head does not matters much, which we can clearly see in above example. But here direction of head plays an important role, in order to break tie between requests and above example is a proof of it.
5. This algorithm is the easy to understand and implement. Here, there is an overhead of finding out the closest request.
6. FCFS does not cause starvation to any request (but may suffer from Convoy effect.). Here, the request which are far from head will suffer starvation.
7. In FCFS algorithm there is decrement in Throughput. Here in SSTF there is increment in Throughput.

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads