A given processor requires 1000 cycles to perform a context switch and start an
ID: 3712972 • Letter: A
Question
A given processor requires 1000 cycles to perform a context switch and start an interrupt handler (and the same number of cycles to switch back to the program that was running when the interrupt occurred), or 500 cycles to poll an I/O device. An I/O device attached to that processor makes 150 requests per second, each of which takes 10,000 cycles to resolve once the handler has been started. By default , the processor polls every 0.5 ms if it is not using interrupts. a. How many cycles per second does the processor spend handling I/O from the device if interrupts are used? b. How many cycles per second are spent on I/O if polling is used (include all polling attempts)? Assume the processor only polls during time slices when user programs are not running, so do not include any context-switch time in your calculation. c. How often would the processor have to poll for polling to take as many cycles per second as interrupts?
Explanation / Answer
a. The device makes 150 requests, each of which require one interrupt. Each interrupt takes 12,000 cycles (1000 to start the handler, 10,000 for the handler,1000 to switch back to the original program), for a total of 18,00,000 cycles spent handling this device each second.
b. The processor polls every 0.5 ms, or 2000 times/s. Each polling attempt takes 500 cycles, so it spends 1,000,000 cycles/s polling. In 150 of the polling attempts, a request is waiting from the I/O device, each of which takes 10,000 cycles to complete for another 1,500,000 cycles. Therefore, the total time spent on I/O each second is 2,500,000 cycles with polling.
c. In the polling case, the 150 polling attempts that find a request waiting consume 1,500,000 cycles. Therefore, for polling to match the interrupt case, an additional 3,00,000 cycles must be consumed, or 600 polls, for a rate of 600 polls/s.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.