disk scheduling algorithms

25
H. Mozaffari, A. Ghanaatpishe, H. Mobasher Information Storage and Retrieval April 21, 2014 Disk scheduling algorithms

Upload: hamid-mozaffari

Post on 07-Apr-2017

1.007 views

Category:

Documents


0 download

TRANSCRIPT

H. Mozaffari, A. Ghanaatpishe, H. Mobasher  Information Storage and Retrieval

April 21, 2014

Disk scheduling algorithms

Introduction Various Scheduling algorithms

FCFS SSTF SCAN C-SCAN N-Step-SCAN, FSCAN LOOK C-LOOK

Comparison of Disk Scheduling Algorithms Conclusion

Overview

What is disk scheduling?Servicing the disk I/O requests

Why disk Scheduling?Use hardware efficiently

Disk scheduling includesFast access time (seek time+ rotational latency)

Introduction

If desired disk drive is available, request is served immediately.

If busy, new request for service will be placed in the queue of pending requests. When one request is completed, the OS has to choose which pending request to service next.

I/O requests, OS handling

To read or write, the disk head must be positioned at the desired track and at the beginning of the desired sector

Seek timeTime it takes to position the head at the desired track

Rotational delay or rotational latencyTime its takes for the beginning of the sector to reach the head

Data transfer timeData transfer occurs as the sector moves under the head

Disk Performance Parameters

Seek time is the reason for differences in performance For a single disk there will be a number of I/O requests If requests are selected randomly, we will poor

performance

Disk Scheduling Policies

Work Queue: 23, 89, 132, 42, 187 There are 200 cylinders numbered from 0 – 199. The disk head stars at number 100.

Example

Process request sequentially. Fair to all processes, no starvation. Approaches random scheduling in performance if there

are many processes.

First come, first serve(FCFS)

FCFS Solution

Work Queue: 23, 89, 132, 42, 187Total seek length:

Select the disk I/O request that requires the least movement of the disk arm from its current position.

Always choose the minimum Seek time.Starvation is possible; stay in one area of the disk. If very busy switching directions, slows things down. Not the most optimal.

Shortest Service Time First (SSTF)

SSTF Solution

Work Queue: 23, 89, 132, 42, 187Total seek length:

Arm moves in one direction only, satisfying all outstanding requests until it reaches the last track in that direction

Direction is reversed Sometimes called the elevator algorithm.

SCAN

SCAN Solution

Work Queue: 23, 89, 132, 42, 187Total seek length:

Restricts scanning to one direction only When the last track has been visited in one direction,

the arm is returned to the opposite end of the disk and the scan begins again

C-SCAN

C-SCAN Solution

Work Queue: 23, 89, 132, 42, 187Total seek length:

Segments the disk request queue into sub queues of length N.

Sub queues are processed one at a time, using SCAN. New requests added to other queue when queue is

processed.

N-step-SCAN

Two queues One queue is empty for new requests

FSCAN

The LOOK algorithm is the same as the SCAN algorithm  in that it also honors requests on both sweep direction of the disk head.

The arm goes only as far as final requests in each direction and then reverses direction without going all the way to the end.

LOOK

LOOK Solution

Work Queue: 23, 89, 132, 42, 187Total seek length:

This is just an enhanced version of C-SCAN. In this, the scanning doesn't go past the last request in

the direction that it is moving.  It too jumps to the other end but not all the way to the end, Just to the furthest request.

C-LOOK

C-LOOK Solution

Work Queue: 23, 89, 132, 42, 187Total seek length:

FCFS SSTF SCAN C-SCAN LOOK C-LOOK

421 263 287 368 241 296Total seek

length

84.2 52.6 57.4 73.6 48.2 59.2Average

seek length

Comparison of Disk Scheduling Algorithms

Performance depends on number of requests. SCAN, C-SCAN for systems that place a heavy load on

the disk, as they are less likely to cause starvation. Default algorithms, SSTF or LOOK

Conclusion

Operating Systems. William Stalling, 7th edition. Example of Disk Scheduling Algorithms:

http://www2.cs.uregina.ca/~hamilton/courses/330/notes/io/node8.html Disk Scheduling, Vaibhav Kumar Gupta

http://www4.comp.polyu.edu.hk/~csajaykr/myhome/teaching/eel358/ds.pdf

Operating System Concepts. Greg Gagne, Peter Baer Galvin, and Abraham Silberschatz, 8th edition.

References

Questions & Discussion