8/4/2019 OS Disk Sheduling
1/23
Chapter 12Mass Storage Structure
8/4/2019 OS Disk Sheduling
2/23
Disk-scheduling
DisciplinesOverview
8/4/2019 OS Disk Sheduling
3/23
Disk-scheduling Disciplines(1)
FCFS (First Come, First Served) Simplest form of disk-scheduling.
Fair, but does not provide the fastest service(seek time may be long).
what comes in first is handled first, what
comes in next waits until the first is finished,
etc.
8/4/2019 OS Disk Sheduling
4/23
Disk-scheduling Disciplines(2)
SSTF (Shortest Seek Time First) Selects the request that is closest to the disk
arm position Good at reducing seeks
May result in starvation
8/4/2019 OS Disk Sheduling
5/23
Disk-scheduling Disciplines(3)
SCAN Adopts an elevator algorithm. It takes the
closest request in the direction of travel. Worst case: if a disk is heavily loaded withrequests, a new request at a location that hasbeen just recently scanned can wait for almost
two full scans of the disk
8/4/2019 OS Disk Sheduling
6/23
Disk-scheduling Disciplines(4)
C-SCAN (Circular SCAN) The disk arm always serves requests by
scanning in one direction Once the arm finishes scanning for onedirection, it quickly returns to the 0th track forthe next round of scanning
8/4/2019 OS Disk Sheduling
7/23
Disk-scheduling Disciplines(5)
LOOK Similar to SCAN
The difference is that LOOK uses informationabout the requests to change the direction ofthe head when it knows that there are norequests beyond the current point
improves both the throughput and theresponse time
8/4/2019 OS Disk Sheduling
8/23
Exercise 12.1
None of the disk-scheduling disciplines,except FCFS, is truly fair (starvation may
occur).a. Explain why this assertion is true.
8/4/2019 OS Disk Sheduling
9/23
Answer 12.1.a
New requests for the track over which thehead is currently resides can arrive as
quickly as these requests are beingserviced.
For example, In SSTF, some process may have to wait a longtime until it's request(s) are satisfied if newrequests with shorter seek time keep arriving.
In SCAN, new arrived requests may be closer tothe current head (in the right direction), hence anold request may be kept waiting.
8/4/2019 OS Disk Sheduling
10/23
Exercise 12.1.b
Describe a way to a modify algorithmssuch as SCAN to ensure fairness.
8/4/2019 OS Disk Sheduling
11/23
Answer 12.1.b
All requests older than somepredetermined age could be forced to
the top of the queue An associated bit for each could be set to
indicate that no new request could bemoved ahead of these requests
8/4/2019 OS Disk Sheduling
12/23
Exercise 12.1.c
Explain why fairness is an important goalin a time sharing system.
8/4/2019 OS Disk Sheduling
13/23
Answer 12.1.c
To prevent unusually long response times.
8/4/2019 OS Disk Sheduling
14/23
Exercise 12.1.d
Give three or more examples ofcircumstances in which it is important that
the operating system be unfair in servingI/O requests.
8/4/2019 OS Disk Sheduling
15/23
Answer 12.1.d
Kernel-initiated I/O take precedence overuser requests.
If the kernel supports real-time processpriorities, the I/O requests for thoseprocesses should be favored.
Paging and swapping should take priorityover user requests.
8/4/2019 OS Disk Sheduling
16/23
Exercise 12.2
Suppose that a disk drive has 5000 cylinders,numbered 0 to 4999. The drive is currently
serving a request at cylinder 143, and theprevious request was cylinder 125. Thequeue pending requests, in FIFO order, is
86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
Starting from the current head position, whatis the total distance (in cylinders) that thedisk arm moves to satisfy all the pendingrequests
8/4/2019 OS Disk Sheduling
17/23
18000
125
143
86
1470
913
1774
948
1509
1022
1750
130
a. First Come First Served
8/4/2019 OS Disk Sheduling
18/23
FCFS total seek time
From cylinder To cylinder Seek Time
143 86 57
86 1470 13841470 913 557
913 1774 861
1774 948 826
948 1509 561
1509 1022 487
1022 1750 728
1750 130 1620
Total Seek Time 7081
8/4/2019 OS Disk Sheduling
19/23
18000
125
143
86
1470
913
1774
948
1509
1022
1750
130
b. Shortest Seek Time First
Total seek distance is 1745
8/4/2019 OS Disk Sheduling
20/23
18000
125
143
86
1470
913
1774
948
1509
1022
1750
1304999
c. SCAN
Total seek distance is 9769
8/4/2019 OS Disk Sheduling
21/23
18000
125
143
86
1470
913
1774
948
1509
1022
1750
130
d. LOOK
Total seek distance is 3319
8/4/2019 OS Disk Sheduling
22/23
18000
125
143
86
1470
913
1774
948
1509
1022
1750
130
4999
e. Circular SCAN
Total seek distance is 9813
0
8/4/2019 OS Disk Sheduling
23/23
18000
125
143
86
1470
913
1774
948
1509
1022
1750
130
f. Circular LOOK
Total seek distance is 3363
Top Related