DSA

DISK SCHEDULLING ALGORITHM

Disk scheduling is done by operating systems to schedule I/O requests arriving for the disk. Disk scheduling is also known as I/O scheduling.

SIMULATE

Seek Time

Seek time is the time taken to locate the disk arm to a specified track where the data is to be read or write.

Rotational Latency

Rotational Latency is the time taken by the desired sector of disk to rotate into a position so that it can access the read/write heads.

Transfer Time

Transfer time is the time to transfer the data. It depends on the rotating speed of the disk and number of bytes to be transferred.

Disk Access Time

Disk Access Time = Seek Time + Rotational Latency + Transfer Time

Disk Response Time

Response Time is the average of time spent by a request waiting to perform its I/O operation

First Come First Serve(FCFS)

FCFS is the simplest of all the Disk Scheduling Algorithms. In FCFS, the requests are addressed in the order they arrive in the disk queue.Let us understand this with the help of an example.

    Advantages:

  • Every request gets a fair chance
  • No indefinite postponement
  • DisAdvantages:

  • Does not try to optimize seek time
  • May not provide the best possible service

Shortest Seek Time First(SSTF)

In SSTF, requests having shortest seek time are executed first. So, the seek time of every request is calculated in advance in the queue & then they are scheduled according to their calculated seek time. So, request near the disk arm will get executed first.

    Advantages:

  • Average Response Time Decreases and Throughput Increases
  • DisAdvantages:

  • Overhead to calculate seek time in advance
  • Can cause Starvation for a request which has higher seek time

SCAN

In SCAN algorithm the disk arm moves into a particular direction and services the requests coming in its path and after reaching the end of disk, it reverses its direction and again services the request arriving in its path. So, this algorithm works as an elevator and hence also known as elevator algorithm. As a result, the requests at the midrange are serviced more and those arriving behind the disk arm will have to wait.

LOOK

It is similar to the SCAN disk scheduling algorithm except for the difference that the disk arm in spite of going to the end of the disk goes only to the last request to be serviced in front of the head and then reverses its direction from there only. Thus it prevents the extra delay which occurred due to unnecessary traversal to the end of the disk.