Shortest Seek Time First Algorithm C Program

 

Let us learn how to implement shortest seek time first algorithm in C programming with its explanation, output, advantages, disadvantages and much more.

What is Shortest Seek Time First Disk Scheduling Algorithm?

The shortest seek time first is commonly abbreviated as SSTF. It is also popularly known as shortest seek first algorithm.

The SSTF disk scheduling algorithm is a secondary storage scheduling algorithm which enables to determine the motion of the disk’s arm and the disk head in servicing read and write requests.

This algorithm helps to determine which job is nearest to the current head position with minimum seek time, and then services that job next.

In the SSTF algorithm, the jobs having the shortest seek time are executed first. Therefore, the seek time of each job is pre-calculated in the job queue and every job is scheduled according to its seek time.

This enables the job nearest to the disk arm to get executed first. It also has a better average response time and throughput as compared to the FCFS scheduling algorithm.

Advantages

  • Reduced total seek time as compared to FCFS algorithm
  • Increased throughput time
  • Decreased average response time

Disadvantages

  • There are high chances of starvation if the seek time is higher than the incoming jobs
  • Switching the directions may slow down the process
  • There are chances of overheads.
  • This algorithm is not the most optimal one

Note: This C program to implement SSTF algorithm is compiled with GNU GCC compiler using CodeLite IDE on Microsoft Windows 10 operating system.

C Program For Shortest Seek Time First Disk Scheduling Algorithm

   

Output

Shortest Seek Time First Scheduling Algorithm in C Programming

If you have any doubts about the implementation of shortest seek first disk scheduling C program, let us know about it in the comment section. Find more about it here.

CPU Scheduling Algorithms
FCFS Algorithm
Preemptive Shortest Job First Algorithm
Round Robin Algorithm
Shortest Job First Algorithm
C SCAN Scheduling C Program
SCAN Algorithm
Multi-Level Feedback Queue Algorithm
Preemptive Priority Algorithm
Priority Scheduling Algorithm

Let's Discuss