Disk Scheduling Full
-
Upload
ahmad-khairil -
Category
Documents
-
view
221 -
download
0
Transcript of Disk Scheduling Full
-
7/30/2019 Disk Scheduling Full
1/12
-
BITS 1213
OPERATING SYSTEM
1 BITI
TITLE:
DISK SCHEDULING ALGORITHM
LECTURER NAME:
DR. NURUL AZMA ZAKARIA
NAME &
MATRIK NO
ADLI MUQMIN BIN AZHAR (B031210304)AHMAD KHAIRIL BIN KASIM (B031210013)ANG KUAN KEE (B031210344)
LUA XIN LIN (B031210345)NOOR ALIA BINTI AHMAD (B031210380)
LECTURERDR. NURUL AZMA ZAKARIA
-
7/30/2019 Disk Scheduling Full
2/12
INTRODUCTION:(CREATED BY LUA XIN LIN)
What is disk-scheduling?
Selecting job/tasks that are to be dispatched in the disk
Why perform disk-scheduling?
To optimize hardware usage by:
o Minimizing seek time
To prioritize I/O requests of certain processes
To allow a large disk bandwidth
To guarantee that certain requests will be issued before a particular deadline
The disk Data Layout of a Magnetic Disk
Disk Performance Parameters
(A hard disk head on an access arm resting on a hard disk platter)
-
7/30/2019 Disk Scheduling Full
3/12
Seek time - the time taken to move the head to the desired track
o Algorithms that reduce seek time:
SSTF
SCAN
C-SCAN
FIFO
LIFO
RSS
PRI
N-SCAN
F-SCAN
Rotational latency the delay waiting for the rotation of the disk to bring the required disk
sector under the read and write head.
o Factors: rotational speed of disk
o Transfer time , T =
, where
b=no. of bytes to be transferred;
N= no. of bytes on track;
r= rotational speed (r.p.m)
RANDOM SCHEDULING ALGORITHM:(CREATED BY AHMAD KHAIRIL)
RSS (Random Scheduling) For analysis and simulation
The reason for the difference in performance can be traced to seek time. If sector access requests
involve selection of tracks at random, then the performance of the disk I/O system will be poor as
possible. Hence, we need to reduce the average time spent on seeks.
The OS maintains a queue of requests for each I/O device. For a single disk there will be number of I/O
requests from various processes in the queue. If selected items from the queue in random order, then
the tracks to be visited will occur randomly, giving poor performance. This random scheduling is useful
as a benchmark against which to evaluate other techniques.
-
7/30/2019 Disk Scheduling Full
4/12
PRIORITY ALGORITHM:
PRI (Priority by process) Control outside of disk queue management
With a system based on priority (PRI), the control of the scheduling is outside the control of disk
management software. Such an approach is not intended to optimize disk utilization but to meet other
objectives within the OS. Often short batch jobs and interactive jobs are given higher priority thanlonger jobs that require longer computation. This allows a lot of short jobs to be flushed through the
system quickly and may provide good interactive response time. However, longer jobs may have to wait
excessively long times. Furthermore, such a policy could lead to countermeasures on the part of users,
who split their jobs into smaller pieces to beat the system. This type of policy tends to be poor for
database systems.
FIRST IN FIRST OUT (FIFO)(CREATED BY ADLI MUQMIN)
The simplest form of scheduling in First In First Out (FIFO) scheduling, which processes items
from the queue in sequential order. This strategy has the advantage of being fair, because every
request is honoured and the requests are honoured in order received.
KEYWORD
Process request sequentially
Fair to all processes
Approaches random scheduling in performance if there are many processes
Figure 1 Illustrates the disk arm movement with FIFO
-
7/30/2019 Disk Scheduling Full
5/12
This graph is generated directly from the data in Table 1. As can be seen, the disk accesses are in
the same order as the requests were originally received.
With FIFO, is there are only a few processes that require access and if many of the requests areto clustered file sectors,then we can hope for good performance. However, this technique will
often approximate random scheduling in performance, if there are many processes competing for
the disk.
Thus, it may be profitable to consider a more sophisticated scheduling policy.
FIFO (starting at track 100)
Next track accessed
5558
3918
90
160150
38
184
Average seek length
Number of tracks traversed
453
1921
72
7010
112
146
55.3
Table 1 Disk scheduling algorithms
LAST IN FIRST OUT (LIFO)
LIFO is an acronym that stands for Last In First Out. By definition, in a LIFO structured linear
list, elements can added or taken off from only one end, called the Top. A LIFO structure can
be illustrated with the example of a stack of trays. The last tray to be placed on top is also the
first to be taken off the top.
LIFO is most used in cases where the last data added to the structure must be the first data to beremoved or evaluated. It need to access the data in limited amounts and in a certain order.
LIFO structure is accessed in opposite order to a queue.
-
7/30/2019 Disk Scheduling Full
6/12
KEYWORD
Good for transaction processing systems The device is given to the most recent user so there should be little
arm movement
Possibility of starvation since a job may never regain the head of the line
The FIFO and LIFO are listed in Table 2 and differences both of them in Figure 2
Table 2 Description of FIFO and LIFO
Figure 2 Differences of FIFO and LIFO
-
7/30/2019 Disk Scheduling Full
7/12
-
7/30/2019 Disk Scheduling Full
8/12
o
o
o
o
-
7/30/2019 Disk Scheduling Full
9/12
o
o And finally
o Which gives us a total of 248 tracks traversed
drawbacks of the SSTF algorithm:
o Starvation:
a disks positioned far from a current area of activity may be starved indefinitely
o switching directions slows down the process
SCAN
(CREATED BY ANG KUAN KEE)
For the FIFO may have some request unfulfilled until the entire queue is emptied. A SCAN
algorithm can prevent this sort of starvation, also known as the elevator algorithm because the
disk arms behaves just like an elevator in a building, first servicing all the requests going up and
then reversing to service requests the other way.
With SCAN, the arm is required to move in one direction only, satisfying all outstanding
requests en route, until it reaches the last track in that direction or until there are no more
requests in that direction, servicing requests as it reaches each cylinder, until it gets to the other
end of the disk.At the other end, the direction of head movement is reversed, and servicing
continues. The head continuously scans back and forth across the disk. So that, it is a better
service distributor.
The service direction is then reversed and the scan proceeds in the opposite direction, again picking up
all requests in order.
-
7/30/2019 Disk Scheduling Full
10/12
This latter refinement is sometimes referred to as the LOOK policy.
It is no difficult to see that the SCAN policy favors jobs whose requests are for tracks nearest to both
innermost and outermost tracks and favors the latest-arriving jobs.
With SCAN, if the expected time for scan from inner track to outer track is t, then the expected service
interval for sectors at the periphery is 2t.
Figure (e) is showing how SCAN work. Assume it starting scan at tracking 100, it will going by the
direction of increasing track number and when no any higher track, it will decreasing slowly till lower
track number.
If a request arrives in the queue just in front of the head, it will be serviced almost immediately.
If a request arriving just behind the head will have to wait until the arm moves to the end of thedisk, reverses direction, and comes back.
C-SCAN
The C-SCAN (circular SCAN) works just like the elevator to some extent and it policy restricts
scanning to one direction only. Thus, when the last track has been visited in one direction, it
begins its scan toward the nearest end and works it way all the way to the end of the system.
Once it hits the bottom or top it jumps to the other end and moves in the same direction. Keep in
mind that the huge jump doesn't count as a head movement. C-SCAN is a fast one way with fast
return but it is lower service variability.
-
7/30/2019 Disk Scheduling Full
11/12
This reduces the maximum delay experienced by new requests.
With C-SCAN, the interval is on the order of t + smax, where smax is the maximum seek time.
As the figure (d) for C-SCAN behavior, assume it starting point at 100, the first three requested track
encountered are 150, 160, and 184. Then it will scan from begins starting at the lowest track number
again to the higher track number.
N-STEP-SCAN(CREATED BY NOOR ALIA)
Segments the disk request queue into subqueues of length N.
Subqueue are processed one at a time, using SCAN.
While a queue is being processed, new requests must be added to some other queue.
If fewer then N requests are available at the end of a scan, then all of them are processed with the
next scan.
With large values of N, the performances of N-step-SCAN approaches that of SCAN; with a value of
N = 1, the FIFO policy is adopted.
Example:
Another way to look at N-step SCAN is this: A buffer for N requests is kept.
All the requests in this buffer are serviced in any particular sweep.
All the incoming requests in this period are not added to this buffer but are kept up in a
separate buffer. When these top N requests are serviced.
The IO scheduler chooses the next N requests and this process continues.
This allows for better throughput and avoids starvation.
-
7/30/2019 Disk Scheduling Full
12/12
FSCAN
It uses two subqueues.
During the scan, all of the requests are in the first queue and all new requests are put into the
second queue.
Thus, service of new requests is deferred until all of the old requests have been processed.
When the scan ends, the arm is taken to the first queue entries and is started all over again.
The conclusion is FSCAN along with N-Step-SCAN prevents "arm stickiness" unlike SSTF,
SCAN, and C-SCAN.
Arm stickiness in those other algorithms occurs when a stream of requests for the same track
causes the disk arm to stop progressing at that track, preferring to satisfy the no-seek requests for
the track it is on.
Because FSCAN separates requests into two queues, with new requests going into a waiting
queue, the arm continues its sweep to the outer track and is therefore not "sticky."
There is an obvious trade-off in that the requests in the waiting queue must wait longer to be
fulfilled, but in exchange FSCAN is more fair to all requests.
http://en.wikipedia.org/wiki/N-Step-SCANhttp://en.wikipedia.org/wiki/Shortest_seek_firsthttp://en.wikipedia.org/wiki/Elevator_algorithmhttp://en.wikipedia.org/wiki/C-SCANhttp://en.wikipedia.org/wiki/C-SCANhttp://en.wikipedia.org/wiki/Elevator_algorithmhttp://en.wikipedia.org/wiki/Shortest_seek_firsthttp://en.wikipedia.org/wiki/N-Step-SCAN