Difference between FCFS and SSTF Disk Scheduling Algorithm

Last Updated : 01 Jul, 2022

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 `

```= (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 `

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

Difference between FCFS and SSTF disk scheduling algorithm :

Previous
Next