Download OS II - HW #4 Solutions: Disk Scheduling Algorithms and Performance - Prof. P. Paulson and more Assignments Computer Science in PDF only on Docsity! CS 411 Operating Systems II Fall 2009 Homework Assignment #4 Solutions Given a disk drive with 5000 cylinders, numbered 0 to 4999. Assume that the disk head is positioned at cylinder 1023, and the previous request was at cylinder 1088. The table below shows a reference string (i.e., a queue of disk I/O requests by cylinder locations in the order received). Note: Here’s a table of “distances” Request # 1 2 3 4 5 6 7 8 Cylinder # 1106 4192 1515 138 1672 2960 120 861 1. Obviously, FCFS would handle the requests in the same order as they were received. List the request numbers in handling-order for the other disk-scheduling algorithms. Algorithm Handling-Order FCFS 1 2 3 4 5 6 7 8 SSTF 1 8 3 5 6 2 4 7 LOOK* (elevator) 8 4 7 1 3 5 6 2 C-LOOK** 1 3 5 6 2 7 4 8 *Note: for LOOK, assume that the head has moved to 1023 because it was the next lowest cylinder number before requests #1-8 arrived. Therefore the next head movement will be in decreasing order of cylinder number. **Note: for C-LOOK, assume that the head has moved to 1023 because it was the lowest cylinder number before requests #1-8 arrived. Therefore the next head movement will be in increasing order of cylinder number. 2. Calculate the total head movement required by each algorithm. Show your work. Algorithm Total Head Movement (Cylinders) FCFS 83+3086+2677+1377+1534+1288+2840+741 = 13,626 SSTF 83+245+654+157+1288+1232+4054+18 = 7731 LOOK 162+723+18+986+409+157+1288+1232 = 4975 C-LOOK 83+409+157+1288+1232+4072+18+723 = 7982 3. Suppose that all requests are for only one block. The transfer rate is 1000 blocks per second (i.e., 1 ms per block). The average seek time is 0.004 ms per cylinder distance. The disk rotates at 10,000 RPM (i.e., the average rotational latency is 3 ms). Calculate the expected time for each algorithm to handle the request queue. Based on the answers to #2, the time is: (Total_head_movement x 0.004) + (8 x (3 + 1)) ms Algorithm Expected Time(ms) FCFS 86.504 ms SSTF 62.924 ms LOOK 51.9 ms C-LOOK 63.928 ms