Exercise #1 Question #1: q1: A CPU-intensive job would use the full time quantum. There are two such jobs: A and D. But A "skips a beat", i.e., it is not scheduled between two of D's CPU bursts. The only possible reason is that A is doing an I/O burst. Therefore D is the job we're looking for. q2: C, because it has the shortest CPU burst and is I/O-bound q3: The CPU utilization of job B is as follows: BBBBBB BBB BBB BBBBBB At a minimum, this could be a first CPU burst of 9ms, followed by an I/O-burst, followed by a 3ms CPU burst, followed by an I/O burst, followed by the beginning of a long CPU burst. So at a mininum 2 I/O-burts could be initiazed in the sequence. At a maximum that would be 4 I/O-burst. Question #2: q1 IIoIIoIIoCCCCCo q2 At time 2ms, the first I/O-bound job starts its I/O burst. That I/O bursts lasts until time t1 = 2ms + 4ms = 6ms, at which point the job is back in the Ready Queue. That job will not run until time t2 = 3*(2+0.1)+5+0.1 = 11.4ms Therefore, it was Ready for t2-t1 = 5.4ms Same reasoning for all other I/O-bound jobs, just shifted by 5.4ms. Final Answer: 5.4ms q3 Let x be the desired overhead. Given the pattern in Question #1, the fraction of the time spent doing context switching is: 4x / (4x + 11) So we simply need to solve for this fraction to be equal to 0.01. 5x = 0.01 * 4x + 0.01 * 11 This gives us: x = 0.01 * 11 / (5 - 0.01 * 4) ~ .0222ms ------------------------------------ Exercise #2: Question #1: q1 A: mid-priority queue B: high-priority queue C: mid-priority queue D: mid-priority queue E: low-priority queue q2 Here is the execution sequence. AAAABBCCCCDDDDEEEEBB 01234567890123456789 At time 4+2+4+4+4 =18 all jobs have run once. All of them but B have been demoted because they have used up their entire time quantum. Therefore B starts its second time quantum at time 18. Question #2: q1 AAA BBBB AAA B AAA B... q2 Yes. In the long run A runs for 3 ms and then job B for 1ms. Therefore job B runs for 1/4 of the time in the long run, which is more than 20%. q3 AAABBBBAAABAAABAAABBBBAAABAAABAAABBBBAAAB 01234567890123456789012345678901234567890 ^ ^ | | boost boost or with spaces: AAA BBBB AAA B AAA B AAA BBBB AAA B AAA B AAA BBBB AAA B 012 3456 789 0 123 4 567 8901 234 5 678 9 012 3456 789 0 ^ ^ | | boost boost