0% found this document useful (0 votes)
33 views17 pages

Disk Scheduling

Uploaded by

rajendrag
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views17 pages

Disk Scheduling

Uploaded by

rajendrag
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

DISK SCHEDULING

1
DISK STRUCTURE
 Disk drives are addressed as large 1-dimensional arrays of
logical blocks, where the logical block is the smallest unit of
transfer.

 The 1-dimensional array of logical blocks is mapped into the


sectors of the disk sequentially.
 Sector 0 is the first sector of the first track on the
outermost cylinder.
 Mapping proceeds in order through that track, then the rest
of the tracks in that cylinder, and then through the rest of
the cylinders from outermost to innermost.
 Lets understand track, sector and cylinder concept.

2
DISK SCHEDULING
 The operating system is responsible for using hardware
efficiently — for the disk drives, this means having a fast
access time and disk bandwidth.
 Access time has two major components
 Seek time is the time for the disk are to move the heads to
the cylinder containing the desired sector.
 Rotational latency is the additional time waiting for the
disk to rotate the desired sector to the disk head.
 Minimize seek time
 Seek time  seek distance
 Disk bandwidth is the total number of bytes transferred,
divided by the total time between the first request for service 3
and the completion of the last transfer.
DISK SCHEDULING (CONT.)
 Several algorithms exist to schedule the servicing of
disk I/O requests.
 We illustrate them with a request queue (0-199).

98, 183, 37, 122, 14, 124, 65, 67

Head pointer 53

4
FCFS SCHEDULING
 The simplest form of disk scheduling is, of course, the first-
come, first-served (FCFS) algorithm. This algorithm is
intrinsically fair, but it generally does not provide the fastest
service.
 If the disk head is initially at cylinder 53, it will first move
from 53 to 98, then to 183, 37, 122, 14, 124,65, and finally to
67, for a total head movement of 640 cylinders.
 The wild swing from 122 to 14 and then back to 124
illustrates the problem with this schedule. If the requests for
cylinders 37 and 14 could be serviced together, before or
after the requests for 122 and 124, the total head movement
could be decreased substantially, and performance could be
thereby improved.
5
FCFS

Illustration shows total head movement of 640 cylinders. 6


SSTF(SHORTEST SLEEK TIME FIRST)
 Itseems reasonable to service all the requests close
to the current head position before moving the head
far away to service other requests.
 Selects the request with the minimum seek time from
the current head position. Clearly, this algorithm
gives a substantial improvement in performance.
 For our example request queue, the closest request to
the initial head position (53) is at cylinder 65. Once
we are at cylinder 65, the next closest request is at
cylinder 67. From there, the request at cylinder 37 is
closer than the one at 98, so 37 is served next.
Continuing, we service the request at cylinder 14,
7
then 98, 122, 124, and finally 183.
SSTF(SHORTEST SLEEK TIME FIRST)
 Illustration shows total head movement of 236
cylinders.
 SSTF scheduling is a form of SJF scheduling; may
cause starvation of some requests.
 Remember that requests may arrive at any time. Suppose that
we have two requests in the queue, for cylinders 14 and 186,
and while the request from 14 is being serviced, a new
request near 14 arrives. This new request will be serviced
next, making the request at 186 wait. While this request is
being serviced, another request close to 14 could arrive. In
theory, a continual stream of requests near one another could
cause the request for cylinder 186 to wait indefinitely.

8
SSTF (CONT.)

9
SCAN SCHEDULING
 The disk arm starts at one end of the disk, and
moves toward the other end, servicing requests
until it gets to the other end of the disk, where
the head movement is reversed and servicing
continues.
 Sometimes called the elevator algorithm.
 Before applying SCAN to schedule the requests on
cylinders 98, 183,37, 122, 14, 124, 65, and 67, we
need to know the direction of head movement in
addition to the head's current position.
 Assuming that the disk arm is moving toward 0 and
10
that the initial head position is again 53, the head
will next service 37 and then 14.
SCAN SCHEDULING
 At cylinder 0, the arm will reverse and will move
toward the other end of the disk, servicing the
requests at 65, 67, 98, 122, 124, and 183 as shown in
the Figure.
 If a request arrives in the queue just in front of the
head, it will be serviced almost immediately; a
request arriving just behind the head will have to
wait until the arm moves to the end of the disk,
reverses direction, and comes back.
 Illustration shows total head movement of 208
cylinders.
11
SCAN (CONT.)

12
C-SCAN SCHEDULING
 Circular Scan(C-Scan) Scheduling is a variant of SCAN
Provides a more uniform wait time.
 Like SCAN, C-SCAN moves the head from one end of the
disk to the other, servicing requests along the way.
 The head moves from one end of the disk to the other.
servicing requests as it goes. When it reaches the other end,
however, it immediately returns to the beginning of the disk,
without servicing any requests on the return trip.
 When the head reaches the other end, however, it
immediately returns to the beginning of the disk without
servicing any requests on the return trip.
 Treats the cylinders as a circular list that wraps around from
the last cylinder to the first one.
13
C-SCAN (CONT.)

14
C-LOOK
 Version of C-SCAN
 Arm only goes as far as the last request in each direction,
then reverses direction immediately, without first going
all the way to the end of the disk.

15
C-LOOK (CONT.)

16
SELECTING A DISK-SCHEDULING ALGORITHM
 Given so many disk-scheduling algorithms, how do we
choose the best one?
 SSTF is common and has a natural appeal because it
increases performance over FCFS.
 SCAN and C-SCAN perform better for systems that place a
heavy load on the disks because they are less likely to cause
a starvation problem.
 Performance depends on the number and types of requests.
 Requests for disk service can be influenced by the file-allocation
method.
 The disk-scheduling algorithm should be written as a separate
module of the operating system, allowing it to be replaced with a
different algorithm if necessary.
 Either SSTF or LOOK is a reasonable choice for the default 17
algorithm.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy