Chapter 12 Model Answers

11,222 views
10,898 views

Published on

Published in: Technology, Spiritual
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
11,222
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
271
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Chapter 12 Model Answers

  1. 1. Chapter 12 Mass Storage Structure
  2. 2. Disk-scheduling Disciplines Overview
  3. 3. Disk-scheduling Disciplines(1) <ul><li>FCFS (First Come, First Served) </li></ul><ul><ul><li>Simplest form of disk-scheduling. </li></ul></ul><ul><ul><li>Fair, but does not provide the fastest service (seek time may be long). </li></ul></ul><ul><ul><li>“ what comes in first is handled first, what comes in next waits until the first is finished, etc.” </li></ul></ul>
  4. 4. Disk-scheduling Disciplines(2) <ul><li>SSTF (Shortest Seek Time First) </li></ul><ul><ul><li>Selects the request that is closest to the disk arm position </li></ul></ul><ul><ul><li>Good at reducing seeks </li></ul></ul><ul><ul><li>May result in starvation </li></ul></ul>
  5. 5. Disk-scheduling Disciplines(3) <ul><li>SCAN </li></ul><ul><ul><li>Adopts an elevator algorithm. It takes the closest request in the direction of travel. </li></ul></ul><ul><ul><li>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 </li></ul></ul>
  6. 6. Disk-scheduling Disciplines(4) <ul><li>C-SCAN (Circular SCAN) </li></ul><ul><ul><li>The disk arm always serves requests by scanning in one direction </li></ul></ul><ul><ul><li>Once the arm finishes scanning for one direction, it quickly returns to the 0 th track for the next round of scanning </li></ul></ul>
  7. 7. Disk-scheduling Disciplines(5) <ul><li>LOOK </li></ul><ul><ul><li>Similar to SCAN </li></ul></ul><ul><ul><li>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 </li></ul></ul><ul><ul><li>improves both the throughput and the response time </li></ul></ul>
  8. 8. Exercise 12.1 <ul><li>None of the disk-scheduling disciplines, except FCFS, is truly fair (starvation may occur). </li></ul><ul><ul><li>Explain why this assertion is true. </li></ul></ul>
  9. 9. Answer 12.1.a <ul><li>New requests for the track over which the head is currently resides can arrive as quickly as these requests are being serviced. </li></ul><ul><li>For example, </li></ul><ul><ul><ul><li>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. </li></ul></ul></ul><ul><ul><ul><li>In SCAN, new arrived requests may be closer to the current head (in the right direction), hence an old request may be kept waiting. </li></ul></ul></ul>
  10. 10. Exercise 12.1.b <ul><li>Describe a way to a modify algorithms such as SCAN to ensure fairness. </li></ul>
  11. 11. Answer 12.1.b <ul><li>All requests older than some predetermined age could be “forced” to the top of the queue </li></ul><ul><li>An associated bit for each could be set to indicate that no new request could be moved ahead of these requests </li></ul>
  12. 12. Exercise 12.1.c <ul><li>Explain why fairness is an important goal in a time sharing system. </li></ul>
  13. 13. Answer 12.1.c <ul><li>To prevent unusually long response times. </li></ul>
  14. 14. Exercise 12.1.d <ul><li>Give three or more examples of circumstances in which it is important that the operating system be unfair in serving I/O requests. </li></ul>
  15. 15. Answer 12.1.d <ul><li>Kernel-initiated I/O take precedence over user requests. </li></ul><ul><li>If the kernel supports real-time process priorities, the I/O requests for those processes should be favored. </li></ul><ul><li>Paging and swapping should take priority over user requests. </li></ul>
  16. 16. Exercise 12.2 <ul><li>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 </li></ul><ul><ul><ul><ul><ul><li>86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130 </li></ul></ul></ul></ul></ul><ul><li>Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy all the pending requests </li></ul>
  17. 17. <ul><li>First Come First Served </li></ul>1800 0 125 143 86 1470 913 1774 948 1509 1022 1750 130
  18. 18. FCFS 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
  19. 19. b. Shortest Seek Time First <ul><li>Total seek distance is 1745 </li></ul>1800 0 125 143 86 1470 913 1774 948 1509 1022 1750 130
  20. 20. c. SCAN <ul><li>Total seek distance is 9769 </li></ul>1800 0 125 143 86 1470 913 1774 948 1509 1022 1750 130 4999
  21. 21. d. LOOK <ul><li>Total seek distance is 3319 </li></ul>1800 0 125 143 86 1470 913 1774 948 1509 1022 1750 130
  22. 22. e. Circular SCAN <ul><li>Total seek distance is 9813 </li></ul>1800 0 125 143 86 1470 913 1774 948 1509 1022 1750 130 4999 0
  23. 23. f. Circular LOOK <ul><li>Total seek distance is 3363 </li></ul>1800 0 125 143 86 1470 913 1774 948 1509 1022 1750 130

×