Task 1. The clock frequency of the CPU is 100 MHz. A keyboard is connected to th
ID: 3731146 • Letter: T
Question
Task 1. The clock frequency of the CPU is 100 MHz. A keyboard is connected to the computer. In average, 10 keys are pressed in a second. Theoretically, two key presses can follow each other in 50 ms, key presses closer than this can not be distinguished by the keyboard. 500 clock cycles are necessary to obtain the status of the keyboard. The interrupt processing needs additional 100 clock cycles (a) How many times do we need to poll the keyboard to not to miss any events? (b) What is the (relative) load of the CPU devoted to the keyboard when the key press events are handled by polling? c) What is the (relative) load of the CPU devoted to the keyboard when the key press events are handled by interrupts?Explanation / Answer
In one second, CPU has 10^8 cycles.
a) For every 50ms, we need to poll the keyboard, so we must poll keyboard 20 (= 1s/(50 ms)) times.
b) cpu load devoted to keyboard = (number of times keyboard is polled * time needed to obtain status of keyboard)/(number of times keys are pressed * time needed to process keys) = 20*500/(10 * 1) = 1000
c) cpu load devoted to keyboard = (number of times interrupts are generated * time needed to process interrupts)/(number of times keys are pressed * time needed to process keys)= 10 * 600 / (10 * 1) = 600
Assumption: Time needed to process keys is 1 clock cycle.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.