Suggested Answers for Q2-4 in Assignment 2 of COMP2320 (Good Luck on your Final Examination) 2. Given a hard disk of 100 tracks (Track 0-99) with Track 0 being the innermost track. Write down the track numbers the disk head will travel for the following 5 disk scheduling algorithms with the following sequence of disk track requests: 90, 35, 30, 50, 52, 58, 47, 85, 82. The disk head is starting at track 49, in the direction of increasing track number. For this exercise, which disk-scheduling algorithm (FIFO, LIFO, SSTF, SCAN, C-SCAN) is most effective? (20 marks) FIFO LIFO SSTF SCAN C-SCAN 3.a 90 82 50 50 50 35 85 52 52 52 30 47 47 58 58 50 58 58 82 82 52 52 35 85 85 58 50 30 90 90 47 30 82 47 30 85 35 85 35 35 82 90 90 30 47 Consider a typical hard disk with the following specifications: Rotation speed: 10000 rpm Average seek time: 10 msec 512-byte sectors and 320 sectors per track (i) What is the average rotation delay for this disk? (1 marks) For one revolution, we have 60 sec / 10000 revolution = 0.006 s = 6 msec. Hence, the average rotation delay is 3 msec. (ii) Assume you are on the right track and at the beginning of the first sector, how much time is needed to read one single track? (1 marks) Reading one track is same as one revolution, hence, it is 6 msec. (iii) If you have a file of size 640 Kbyte, and it is stored sequentially on the disk, how much time is needed to read this file from the disk? (4 marks) A 640 Kbyte file occupied 640 Kbyte / 0.5 Kbyte = 1280 sectors. 1280 sector / 320 sector per track = 4 tracks. It takes 10 msec to go to the first track. With an average rotation delay of 3 msec, we can read the first track for 6 msec. Total time = 19 msec + 3 X 9 msec = 46 msec. (iv) How much time is needed to read the same file in Part (iii) if each sector of the file is randomly distributed over the disk? (4 marks) Same as part (iii), we have to read 1280 sector randomly distributed over the disk. To read one sector, we have to 10 msec of seek time to find the track, 3 msec of average rotation delay , and 6/320 msec to read a sector. Hence, the time to read one sector is: 13.01875 msec. Thus, the time to read this 1280-sector file needs: 13.01875 X 1280 = 16,664 msec. 3.b Consider the following disk request arrival. Arrival Time (msec) 0 1 2 35 36 37 55 56 57 Track Request 30 0 80 10 50 65 40 12 75 You can assume that at time = 0, the disk head is at Track 30 and each disk access will take 20msec. (i) What is the disk access sequence under the SSTF scheduling policy? (5 marks) 30, 0, 10, 12, 40, 50, 65, 75, 80 (ii) What is the disk access sequence under the SCAN scheduling policy? (Note: The disk head is moving in the direction to the higher numbered tracks) (5 marks) 30, 80, 65, 50, 40, 12, 10, 0, 75 4. Given the following set of processes, sketch the run-time schedule according to each of the scheduling policy below: (60 marks) Process 1 2 3 4 5 i) ii) iii) iv) v) vi) Arrival Time 0 2 4 6 8 Service Time 3 6 4 6 3 Round Robin (Quantum = 1) Round Robin (Quantum = 2) Round Robin (Quantum = 3) Multiple Feedback Queues (Quantum = 1 for every queue) Multiple Feedback Queues (Quantum = 2 for every queue) Multiple Feedback Queues (Quantum = 2i where i = 0, 1, 2, 3, …) Q.4 (60 marks) Part1.out: t = 1 pid = 1 t = 2 pid = 1 t = 3 pid = 2 t = 4 pid = 1 (FINISH) t = 5 pid = 2 t = 6 pid = 3 t = 7 pid = 2 t = 8 pid = 4 t = 9 pid = 3 t = 10 pid = 2 t = 11 pid = 5 t = 12 pid = 4 t = 13 pid = 3 t = 14 pid = 2 t = 15 pid = 5 t = 16 pid = 4 t = 17 pid = 3 (FINISH) t = 18 pid = 2 (FINISH) t = 19 pid = 5 (FINISH) t = 20 pid = 4 t = 21 pid = 4 t = 22 pid = 4 (FINISH) Part3.out: t = 1 pid = 1 t = 2 pid = 1 t = 3 pid = 1 (FINISH) t = 4 pid = 2 t = 5 pid = 2 t = 6 pid = 2 t = 7 pid = 3 t = 8 pid = 3 t = 9 pid = 3 t = 10 pid = 4 t = 11 pid = 4 t = 12 pid = 4 t = 13 pid = 2 t = 14 pid = 2 t = 15 pid = 2 (FINISH) t = 16 pid = 5 t = 17 pid = 5 t = 18 pid = 5 (FINISH) t = 19 pid = 3 (FINISH) t = 20 pid = 4 t = 21 pid = 4 t = 22 pid = 4 (FINISH) Part5.out: t = 1 pid = 1 t = 2 pid = 1 t = 3 pid = 2 t = 4 pid = 2 t = 5 pid = 3 t = 6 pid = 3 t = 7 pid = 4 t = 8 pid = 4 t = 9 pid = 5 t = 10 pid = 5 t = 11 pid = 1 t = 12 pid = 2 t = 13 pid = 2 t = 14 pid = 3 t = 15 pid = 3 t = 16 pid = 4 t = 17 pid = 4 t = 18 pid = 5 t = 19 pid = 2 t = 20 pid = 2 t = 21 pid = 4 t = 22 pid = 4 Part2.out: t = 1 pid = 1 t = 2 pid = 1 t = 3 pid = 2 t = 4 pid = 2 t = 5 pid = 1 (FINISH) t = 6 pid = 3 t = 7 pid = 3 t = 8 pid = 2 t = 9 pid = 2 t = 10 pid = 4 t = 11 pid = 4 t = 12 pid = 3 t = 13 pid = 3 (FINISH) t = 14 pid = 5 t = 15 pid = 5 t = 16 pid = 2 t = 17 pid = 2 (FINISH) t = 18 pid = 4 t = 19 pid = 4 t = 20 pid = 5 (FINISH) t = 21 pid = 4 t = 22 pid = 4 (FINISH) Part4.out: t = 1 pid = 1 t = 2 pid = 1 t = 3 pid = 2 t = 4 pid = 1 (FINISH) t = 5 pid = 3 t = 6 pid = 2 t = 7 pid = 4 t = 8 pid = 3 t = 9 pid = 5 t = 10 pid = 4 t = 11 pid = 5 t = 12 pid = 2 t = 13 pid = 3 t = 14 pid = 4 t = 15 pid = 5 (FINISH) t = 16 pid = 2 t = 17 pid = 3 (FINISH) t = 18 pid = 4 t = 19 pid = 2 t = 20 pid = 4 t = 21 pid = 2 (FINISH) t = 22 pid = 4 (FINISH) Part6.out: t = 1 pid = 1 t = 2 pid = 1 t = 3 pid = 1 (FINISH) t = 4 pid = 2 t = 5 pid = 3 t = 6 pid = 2 t = 7 pid = 2 t = 8 pid = 4 t = 9 pid = 5 t = 10 pid = 3 t = 11 pid = 3 t = 12 pid = 4 t = 13 pid = 4 t = 14 pid = 5 t = 15 pid = 5 (FINISH) t = 16 pid = 2 t = 17 pid = 2 t = 18 pid = 2 (FINISH) t = 19 pid = 3 (FINISH) t = 20 pid = 4 t = 21 pid = 4 t = 22 pid = 4 (FINISH) (FINISH) (FINISH) (FINISH) (FINISH) (FINISH)