FCFS: First Come First Serve


FCFS (First Come First Serve) is simplest disk scheduling algorithm. Each requests are taken/executed in the sequence of their arrival in the disk queue. As a result, there is no starvation in this algorithm. However, it isn't fast compared to other algorithms.


Advantages:


Disadvantages:

Example:

Steps to Implement Algorithm:

  1. Let Request array represents an array storing indexes of tracks that have been requested in ascending order of their time of arrival. 'head' is the position of disk head.
  2. Let us one by one take the tracks in default order and calculate the absolute distance of the track from the head.
  3. Increment the total seek count with this distance.
  4. Currently serviced track position now becomes the new head position.
  5. Go to step 2 until all tracks in request array have not been serviced.

Time Complexity: O ( N )   Auxiliary Space: O ( N )

Simulate