# Major Activities of an Operating System with Regard to Secondary Storage Management

Secondary storage devices are non-volatile devices where the data is stored for long-term storage. Disks are the mainly used secondary storage devices. They provide the bulk of secondary storage in operating systems today.

The main activity that is performed in secondary storage management is disk scheduling. There are many disk scheduling algorithms. However, the important ones are FCFS scheduling, SSTF scheduling, SCAN scheduling and LOOK scheduling.

All the disk scheduling algorithms are explained using the following requests for the disk -

10, 95, 23, 78, 80

## First Come First Served Scheduling

In first come first served scheduling, the requests are serviced in their coming order. This algorithm is fair as it allows all requests a chance but it does not provide the fastest possible service. An example of FCFS scheduling is given below -

In the above example, the requests are serviced in the order they appear i.e 10, 95, 23, 78, 80. The seek head is initially positioned at 50 and it starts from there.

## Shortest Seek Time First Scheduling

The requests that are closest to the current head are served first before moving away in shortest seek time first scheduling algorithm. A problem with the SSTF algorithm is that it may cause starvation for some requests.

An example of SSTF scheduling is given below -

In the above example, the requests are serviced in the order 23, 10, 78, 80, 95. The seek head is initially positioned at 50 and it starts from there. 23 is closest to 50 so it is serviced first. Then 10 is closer to 23 than 78 so it is serviced next. After this 78, 80 and 95 are serviced.

## SCAN Scheduling

In this scheduling algorithm, the head moves towards one direction while servicing all the requests in that direction until it reaches the end of the disk. After that it starts moving towards the other direction. In this way, the head continuously scans back and forth across the disk.

An example of SCAN scheduling is given below -

In the above example, the requests are serviced in the order 23, 10, 78, 80, 95. The head is initially at 50 and moves towards the left while servicing requests 23 and 10. When it reaches the end of the disk, it starts moving right and services 78, 80 and 95 as they occur.

## LOOK Scheduling

### LOOK scheduling algorith

m is similar to SCAN scheduling but is its practical version. In this algorithm, the head moves towards one direction while servicing all the requests in that direction until it reaches the last request. After that, it starts moving towards the other direction. An example of LOOK scheduling is given below -

In the above example, the requests are serviced in the order 23, 10, 78, 80, 95. The head is initially at 50 and moves towards the left while servicing requests 23 and 10. When it reaches the last request on the left i.e. 10, it starts moving right and services 78, 80 and 95 as they occur.