Suppose that in responding to interrupts from IO deviceA the
Suppose that in responding to interrupts from I/O deviceA the processor consumes 1000 cycles to perform the context switch required to transfer control to the interrupt handler. The interrupt handler takes an additional 10,000 cycles to service the device request. Once the interrupt processing is complete, another 1000 cycles are required to perform the context switch required to return from the interrupt handler and resume the program that was running. The processor’s cycle time is 0.5 nano-seconds.
A) Suppose that a program running on the same processor polls some other device (DeviceB) for requests. If each polling operation takes 150 nano-seconds, what is the maximum time that could be taken to service the device if the device generates 2 million requests per second.
Solution
Define the percent ``Useful CPU Usage\'\' of the system to be the ratio of (Total CPU time) minus (Time spent performing context switches) to (Total CPU time). What is the percent useful CPU usage if the scheduler runs with a time quantum of 1 ms? A: IO1 waits for 6ms 1 ms IO1 CS IO2 CS IO3 CS CPU CS IO1 CS IO2 CS IO3 CS CPU CS … As seen above, for every 1ms execution a 1ms Context Switch takes place: Total CPU Time: 16 ms Useful CPU Usage: (16ms 8ms) / 16 ms = 50% Context Switches: 8 ms
a) The processor polls every 0.5 ms,2000 times/s.Each polling attempt takes 500 cycles.so it spends 1,000,000 cycles.
