You are on page 1of 9

Disk Scheduling

Why Disk Scheduling Algorithm is needed?

Disk Scheduling Algorithms are needed because a process can make multiple I/O
requests and multiple processes run at the same time. The requests made by a
process may be located at different sectors on different tracks. Due to this, the seek
time may increase more. These algorithms help in minimizing the seek time by
ordering the requests made by the processes.

The purpose of disk scheduling is to choose a disk request from the input/output
requests queue and then scheduling the remaining request means which has to be
processed

In operating systems, seek time is very important. Since all device requests are
linked in queues, the seek time is increased causing the system to slow down.
Disk Scheduling Algorithms are used to reduce the total seek time of any
request.

Objective of Disk Scheduling Algorithm

The objectives of the disk scheduling algorithm are:

 Less traveling head time.

 Fairness.

 High Throughput.
Basic Terms

There are various types of disk scheduling algorithms, but before discussing
them, we need to know various essentials terms which are given below:

Seek Time : It is the time taken in locating the disk arm to a specified track
where the read/write request will be satisfied.

Rotational Latency : It is the time taken by a desired sector of the disk to rotate
itself to the position where it can access the Read/Write heads.

Transfer Time - It is the time taken to transfer the data requested by the
processes.

Disk Access Time - Disk Access time is the sum of the Seek Time, Rotational
Latency, and Transfer Time.

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

Disk Response Time : It is the average of time spent by each request waiting for
the IO operation.
Types of Disk Scheduling Algorithms

In operating systems, seek time is very important. Since all device requests are
linked in queues, the seek time is increased causing the system to slow down. Disk
Scheduling Algorithms are used to reduce the total seek time of any request.

A Process makes the I/O requests to the operating system to access the disk. Disk
Scheduling Algorithm manages those requests and decides the order of the disk
access given to the requests.

 The purpose of disk scheduling algorithms is to reduce the total


seek time.

There are various types of disk scheduling algorithms such as


 First Come First Serve (FCFS)
 Shortest Seek Time First (SSTF)
 SCAN
 LOOK
 C-SCAN
 C-LOOK

First Come First Serve (FCFS)


 As the name suggests, this algorithm entertains requests in the order they
arrive in the disk queue.
 It is the simplest disk scheduling algorithm.

Advantages-

 It is simple, easy to understand and implement.


 It does not cause starvation to any request.

Disadvantages-

 It results in increased total seek time.


 It is inefficient.
Problem

Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41,
122, 14, 124, 65, 67. The FCFS scheduling algorithm is used. The head is initially
at cylinder number 53. The cylinders are numbered from 0 to 199. The total head
movement (in number of cylinders) incurred while servicing these requests is

Solution

Total head movements incurred while servicing these requests


= (98 – 53) + (183 – 98) + (183 – 41) + (122 – 41) + (122 – 14) + (124 – 14) +
(124 – 65) + (67 – 65)
= 45 + 85 + 142 + 81 + 108 + 110 + 59 + 2
= 632
In this algorithm, the requests are served in the order they come. Those who come
first are served first. This is the simplest algorithm.
Eg. Suppose the order of requests are 70, 140, 50, 125, 30, 25, 160 and the initial
position of the Read-Write head is 60.

Seek Time = Distance Moved by the disk arm


= (140-70)+(140-50)+(125-50)+(125-30)+(30-25)+(160-25)=480

Problem

Consider the following disk request sequence for a disk with 100 tracks 45, 21,
67, 90, 4, 50, 89, 52, 61, 87, 25
Head pointer starting at 50 and moving in left direction. Find the number of head
movements in cylinders using FCFS scheduling.
Solution
= (50-45) + (45-21)+ (67-21)+ (90-67) + (90-4) + (50-4) + (89-50) + (61-52) +
(87-61) + (87-25)

= 5 + 24 + 46 + 23 + 86 + 46 + 49 + 9 + 26 + 62

= 376

Shortest Seek Time First (SSTF)


In SSTF (Shortest Seek Time First), requests having shortest seek time are
executed first. So, the seek time of every request is calculated in advance in the
queue and then they are scheduled according to their calculated seek time. As a
result, the request near the disk arm will get executed first. SSTF is certainly an
improvement over FCFS as it decreases the average response time and increases
the throughput of system.Let us understand this with the help of an example.

It allows the head to move to the closest track in the service queue.

Problem

Suppose the order of request is- (82,170,43,140,24,16,190)


And current position of Read/Write head is : 50

Solution

So, total seek time:


=(50-43)+(43-24)+(24-16)+(82-16)+(140-82)+(170-140)+(190-170)
=208
Number of cylinders = 5 + 7 + 9 + 6 + 20 + 2 + 1 + 65 + 4 + 17 = 136

You might also like