0% found this document useful (0 votes)
18 views

Chapter6 Diskscheduling

Uploaded by

Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Chapter6 Diskscheduling

Uploaded by

Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

Chapter 6

I/O Management
Moving-head Disk Mechanism
• 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.

• Disk scheduling is important because:

• Multiple I/O requests may arrive by different processes and only one
I/O request can be served at a time by the disk controller. Thus other
I/O requests need to wait in the waiting queue and need to be
scheduled.

• Two or more request may be far from each other so can result in
greater disk arm movement.

• Hard drives are one of the slowest parts of the computer system and
thus need to be accessed in an efficient manner.
• There are many Disk Scheduling Algorithms but before discussing them
let’s have a quick look at some of the important terms:

• 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. So the disk
scheduling algorithm that gives minimum average seek time is better.

• 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. So the disk scheduling algorithm that gives minimum
rotational latency is better.

• 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 = Seek Time + Rotational Latency + Transfer Time


• Disk Scheduling Algorithms

• 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.
Advantages
• Easy to understand and implement
• No starvation (Must suffer from convoy effect)
• Can be used with less load
Disadvantages
• Required more seek time
• More waiting time and response time
• Inefficient
• 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.
In short
• Service the request which is closest to the current
position of read/write head.
• Tie broken in the direction of head movement.
Advantages
• Very efficient in seek moves
• Less average response time and waiting time.
• Incremental throughput
Disadvantages
• Overhead to find out the closest request
• Request which are far from will starve
• High variance in response time and waiting time
• Example –
Request sequence = {176, 79, 34, 60, 92, 11,
41, 114}
Initial head position = 50
The following chart shows the sequence in which requested tracks are serviced using
SSTF.

Therefore, total seek count is calculates as:


= (50-41)+(41-34)+(34-11)+(60-11)+(79-60)+(92-79)+(114-92)+(176-
114) = 204
• Example 2
• 98 , 183 , 41 , 122 , 14 , 124 , 65 , 67
• Read/Write head is at 53

0 14 41 53 65 67 98 122 124 183 199


• (65-53) + (67-65) + (67-41) + (41-14) + (98-14)
+(122-98) + (124-122) + (183-124)
=236
SCAN: Head starts at one end of the disc and
moves towards the other end servicing
request in between and return.
• Then direction of the head is reversed and
process continues
• Head continuously scan back n forth across
the disk.
• Sometimes called as elevator algorithm.
Request sequence = {176, 79, 34, 60, 92, 11,
41, 114}

Initial head position = 50

Direction = left (We are moving from right to


left)
Output:
Total number of seek operations = 226

Seek Sequence is

41
34
11
0
60
79
92
114
176
• The following chart shows the sequence in which requested tracks
are serviced using SCAN.

Therefore, the total seek count is calculated as:

= (50-41)+(41-34)+(34-11) +(11-0)+(60-0)+ (79-60) +(92-79)+(114-


92)+(176-114)

= 226
• CSCAN: Head start at one end of the disk and
moves towards the other end servicing requests
in between and reach other end and then
direction of the head is reversed and head
reaches first end without satisfying any request.
Advantages
• Provides uniform waiting time.
• Better response time.
Disadvantage
• More seeks movements compared to simple
SCAN
Advantages
• Simple to understand and implement.
• No starvation(bounded waiting).
• Low variance and average waiting time.

Disadvantage
• Long waiting for locations just visited by head.
• Unnecessary moves till the end of the disk
there is no request.
Input: Request sequence = {176, 79, 34, 60, 92, 11, 41, 114}
Initial head position = 50

Output:

Initial position of head: 50

Total number of seek operations = 389

Seek Sequence is 60 79 92 114 176 199 0 11 34 41


• The following chart shows the sequence in
which requested tracks are serviced using
SCAN.
• Therefore, the total seek count is calculated as:

= (60-50)+(79-60)+(92-79) +(114-92)+

(176-114)+(199-176)+(199-0) +(11-0)+

(34-11)+(41-34)

= 389
• LOOK: It is same as SCAN algorithm but
instead of going till last track we will go last
request and then change direction.
• Advantages
• Better performance compared to SCAN.
• Should be used in case of less load.
Input: Request sequence =
{176, 79, 34, 60, 92, 11, 41, 114}
Initial head position = 50
Direction = right (We are moving from left to right)
Output: Initial position of head: 50
Total number of seek operations = 291
Seek Sequence is
60
79
92
114
176
41
34
11
Therefore, the total seek count is calculated as:
= (60-50)+(79-60)+(92-79) +(114-92)+(176-114) +(176-41)+(41-
34)+(34-11)
CLOOK: It takes the advantages of both C-SCAN and
look algorithm.
• Will satisfy request only in one direction.
• Will go till last request and return but not till last
track.
Advantages
• More uniform time compared to look.
• More efficient (less moves)compared to C-SCAN .
Disadvantages
More overload in calculation.
Should not be used incase of more load.
• Input:
Request sequence = {176, 79, 34, 60, 92, 11, 41, 114}
Initial head position = 50
Direction = right (Moving from left to right)
Output:
Initial position of head: 50
Total number of seek operations = 156
Seek Sequence is
60
79
92
114
176
11
34
41
• The following chart shows the sequence in which
requested tracks are serviced using C-LOOK.

Therefore, the total seek count = (60 – 50) + (79 – 60) + (92 –
79) + (114 – 92) + (176 – 114) + (176 – 11) + (34 – 11) + (41 –
34) = 321
FCFS Example 2

Request sequence = {176, 79, 34, 60, 92, 11, 41, 114}

Head position at 50
Output: Total number of seek operations = 510

Seek Sequence is

176
79
34
60
92
11
41
114
Therefore, the total seek count is calculated as:

= (176-50)+(176-79)+(79-34)+(60-34)+(92-60)+
(92-11)+(41-11)+(114-41) = 510

98 183 41 122 14 124 65 67


Read write head is at 53

You might also like