Chapter 12 Model Answers
-
Upload
sherougm -
Category
Technology
-
view
9.895 -
download
1
Transcript of Chapter 12 Model Answers
![Page 1: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/1.jpg)
Chapter 12Chapter 12Mass Storage Structure
![Page 2: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/2.jpg)
Disk-scheduling Disk-scheduling DisciplinesDisciplines
Overview
![Page 3: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/3.jpg)
Disk-scheduling Disciplines(1)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.”
![Page 4: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/4.jpg)
Disk-scheduling Disciplines(2)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
![Page 5: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/5.jpg)
Disk-scheduling Disciplines(3)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 with
requests, a new request at a location that has been just recently scanned can wait for almost two full scans of the disk
![Page 6: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/6.jpg)
Disk-scheduling Disciplines(4)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 one
direction, it quickly returns to the 0th track for the next round of scanning
![Page 7: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/7.jpg)
Disk-scheduling Disciplines(5)Disk-scheduling Disciplines(5)
LOOK◦Similar to SCAN◦The difference is that LOOK uses information
about the requests to change the direction of the head when it knows that there are no requests beyond the current point
◦improves both the throughput and the response time
![Page 8: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/8.jpg)
Exercise 12.1Exercise 12.1
None of the disk-scheduling disciplines, except FCFS, is truly fair (starvation may occur).a. Explain why this assertion is true.
![Page 9: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/9.jpg)
Answer 12.1.aAnswer 12.1.a
New requests for the track over which the head is currently resides can arrive as quickly as these requests are being serviced.
For example, In SSTF, some process may have to wait a long
time until it's request(s) are satisfied if new requests with shorter seek time keep arriving.
In SCAN, new arrived requests may be closer to the current head (in the right direction), hence an old request may be kept waiting.
![Page 10: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/10.jpg)
Exercise 12.1.bExercise 12.1.b
Describe a way to a modify algorithms such as SCAN to ensure fairness.
![Page 11: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/11.jpg)
Answer 12.1.bAnswer 12.1.b
All requests older than some predetermined 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 be moved ahead of these requests
![Page 12: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/12.jpg)
Exercise 12.1.cExercise 12.1.c
Explain why fairness is an important goal in a time sharing system.
![Page 13: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/13.jpg)
Answer 12.1.cAnswer 12.1.c
To prevent unusually long response times.
![Page 14: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/14.jpg)
Exercise 12.1.dExercise 12.1.d
Give three or more examples of circumstances in which it is important that the operating system be unfair in serving I/O requests.
![Page 15: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/15.jpg)
Answer 12.1.dAnswer 12.1.d
Kernel-initiated I/O take precedence over user requests.
If the kernel supports real-time process priorities, the I/O requests for those processes should be favored.
Paging and swapping should take priority over user requests.
![Page 16: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/16.jpg)
Exercise 12.2Exercise 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 the previous request was cylinder 125. The queue pending requests, in FIFO order, is
86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy all the pending requests
![Page 17: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/17.jpg)
18000
125
143
86
1470
913
1774
948
1509
1022
1750
130
a.a. First Come First ServedFirst Come First Served
![Page 18: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/18.jpg)
FCFS total seek timeFCFS total seek time
From cylinder To cylinder Seek Time
143 86 57
86 1470 1384
1470 913 557
913 1774 861
1774 948 826
948 1509 561
1509 1022 487
1022 1750 728
1750 130 1620
Total Seek Time 7081
![Page 19: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/19.jpg)
18000
125
143
86
1470
913
1774
948
1509
1022
1750
130
b. Shortest Seek Time Firstb. Shortest Seek Time First
Total seek distance is 1745
![Page 20: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/20.jpg)
18000
125
143
86
1470
913
1774
948
1509
1022
1750
130
4999
c. SCANc. SCAN
Total seek distance is 9769
![Page 21: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/21.jpg)
18000
125
143
86
1470
913
1774
948
1509
1022
1750
130
d. LOOKd. LOOK
Total seek distance is 3319
![Page 22: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/22.jpg)
18000
125
143
86
1470
913
1774
948
1509
1022
1750
130
4999
e. Circular SCANe. Circular SCAN
Total seek distance is 9813
0
![Page 23: Chapter 12 Model Answers](https://reader035.fdocuments.net/reader035/viewer/2022081508/55782d7fd8b42a9b438b4f5c/html5/thumbnails/23.jpg)
18000
125
143
86
1470
913
1774
948
1509
1022
1750
130
f. Circular LOOKf. Circular LOOK
Total seek distance is 3363