# Difference between FCFS and SSTF Disk Scheduling Algorithm

• Last Updated : 27 May, 2020

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:

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

`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 the name suggests it serves the request which is closest to the current position of head or pointer. In this algorithm direction of the 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.

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