In this article we will learn about the why we study or use disk scheduling in OS. In operating system disk scheduling is major concern to access the hard disk. Because of the using disk scheduling we can access or speed up the access hard disk.
Before understand the aspect about disk scheduling let’s some common terms regarding disk scheduling.
Times in disk scheduling
In operating system some time is defined in reference of disk. Which is describe one by one as following
Seek time is defined as the time required to reach read/write head to desired track from its current position is called as Seek Time. This time important time in disk because of the read/write head movement is change this time according to our scheduling. That is our major goal of disk scheduling is minimizing the seek time. And seek time is nearly equals to seek distance.
Rotation latency is defined as the time required by read/write head to reach desired sector in particular track. In average we assume the rotation latency is half of rotation time. i.e. R/2.
Transfer time is the actual time required to read or write the data on hard disk. Means the time required to transfer data either read or write to hard disk is called as the transfer time. This time depends upon the rotational rate and total size of the track. If rotational rate is given then transfer time is calculated “In one rotation time we can transfer total size of the track then to transfer required data how much time is required.”
And If the one rotation time is given then transfer time is “one rotation time is required to transfer one track size then how much time is required to transfer required size data”.
In this time many disk scheduling is available. Some of is discussed here.
1. FCFS (First Come First Serve)
FCFS (First Come First Serve) is simplest scheduling algorithm. In this algorithm as request for read/write is comes in order scheduled. This algorithm is simple to implement but it may cause thrashing when the system is busy.
2. SSTF (Shortest Seek Time First)
In scheduling algorithm move the read/write head from its current position to nearest track or sector request (minimum seek time). This algorithm is same same characteristic as the Shortest Job First scheduling algorithm of process. In this algorithm one problem is that the may cause starvation for some request.
3. SCAN Scheduling
In this disk scheduling head is moved from it’s current position to one end provide servicing until the get’s to other end after that head is reversed the direction and service to the end. It is also called as elevator algorithm because of the it’s works same as the elevator works.
4. Circular SCAN (C-SCAN) Scheduling algorithm
This algorithm is same as the SCAN but the difference is that the after reaches the end then head immediately returns to beginning of the disk without servicing any requests.
5. LOOK Scheduling
In this disk scheduling read/write head will look for the last pending request for data in the direction of it’s movement. Means the head is movement not disturb and only look the pending requests in its movement.
Why we study it or use it.
Disk scheduling is studied or use because of the it provide the better solution to minimize the access time required to read/write data to hard disk. If we not use disk scheduling then read/write time is more and overhead. But operating system is responsible for managing the hardware efficiently that’s why we use disk scheduling.
Total time required to access the hard disk is calculated as following
Total Time required to access= Seek time + Rotation Latency + Transfer time.
How choose better algorithm
If we confuse about selecting the disk scheduling algorithm then we should be written disk scheduling algorithms in separate module of operating system. So that we can easily switch to other scheduling algorithm.
To select better algorithm for disk scheduling is depends upon the different factors such as the if the system place heavy load on the disk then we can select SCAN or C-SCAN. Because of the in SCAN and C-SCAN algorithms head movements is not switching every time it only switch when the end of disk is gets.
In normal way we can choose the SSTF or LOOK scheduling algorithm. Because of it’s reasonable result.