Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

# Explain various Disk scheduling algorithms with Illustrations ?

Disk scheduling algorithms are used by the operating system to determine the order in which disk requests are serviced.

## The following are some commonly used disk scheduling algorithms:

1. First Come, First Served (FCFS)
2. Shortest Seek Time First (SSTF)
3. SCAN
4. C-SCAN
5. Look

## 1. First Come, First Served (FCFS):

In this algorithm, the disk requests are serviced in the order they are received. The first request to arrive is serviced first, followed by the second request, and so on. This algorithm is simple and easy to implement but can lead to long wait times for requests that are located far from the current disk head position.

## Illustration:

Consider the following disk requests in track order: 98, 183, 37, 122, 14, 124, 65, 67.
Starting position of the disk head is at track 53. The total amount of head movement required is 640 tracks.

## 2. Shortest Seek Time First (SSTF):

In this algorithm, the disk head moves to the request that is closest to its current position. This reduces the average wait time for requests and improves the overall disk performance.

## Illustration:

Consider the same disk requests as above with the same starting position. The total amount of head movement required is reduced to 236 tracks.

## 3. SCAN:

In this algorithm, the disk head moves in one direction servicing requests until it reaches the end of the disk, then reverses direction and services requests in the opposite direction. This algorithm provides good service times for all requests, but can lead to some requests waiting longer than others.

## Illustration:

Consider the same disk requests as above with the same starting position. The total amount of head movement required is 208 tracks.

## 4. C-SCAN:

In this algorithm, the disk head moves in one direction servicing requests until it reaches the end of the disk, then immediately moves to the opposite end of the disk and begins servicing requests again in the same direction. This algorithm provides good service times for all requests and ensures that no requests wait longer than others.

## Illustration:

Consider the same disk requests as above with the same starting position. The total amount of head movement required is 143 tracks.

## 5. Look:

In this algorithm, the disk head services requests in one direction until there are no more requests in that direction, then reverses direction and services requests in the opposite direction. This algorithm reduces the head movement compared to SCAN and provides good service times for all requests.

## Illustration:

Consider the same disk requests as above with the same starting position. The total amount of head movement required is 202 tracks.

The choice of algorithm depends on the specific requirements of the system, the characteristics of the workload, and the desired trade-offs between performance metrics such as throughput, response time, and fairness.