Question
A keyboard connected to a computer is used at a rate of 1 keystroke per second. The computer system polls the keyboard every 10 ms (milli seconds) to check for a keystroke and consumes 100 s (micro seconds) for each poll. If it is determined after polling that a key has been pressed, the system consumes an additional 200 s to process the keystroke. Let denote the fraction of a second spent in polling and processing a keystroke.
In an alternative implementation, the system uses interrupts instead of polling. An interrupt is raised for every keystroke. It takes a total of 1 ms for servicing an interrupt and processing a keystroke. Let denote the fraction of a second spent in servicing the interrupt and processing a keystroke.
The ratio is _______. (Rounded off to one decimal place)
Official answer and solution
- Official answer
- 10.2
- From
- Official GATE 2023 answer key
Solution
Compute the time fractions (polling overhead) and (interrupt overhead) per second and take their ratio.
-
Polling Mode ():
- Polling frequency: every , which is polls per second.
- Polling check cost: .
- Keystroke processing: 1 keystroke per second adds .
- Total time spent in 1 second: .
-
Interrupt Mode ():
- 1 keystroke per second generates 1 interrupt.
- Total time to service interrupt and process keystroke is .
- Total time spent in 1 second: .
-
Ratio:
10.2
Forgetting the keystroke processing time in the polling implementation, which would erroneously give .
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2023 Computer Science and Information Technology (CS)
- Question
- 34 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.