Skip to content
GATEiit

GATE CSE 2023 Q34: Polling vs interrupt overhead for keyboard input

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 T1T_1 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 T2T_2 denote the fraction of a second spent in servicing the interrupt and processing a keystroke.

The ratio T1T2\dfrac{T_1}{T_2} is _______. (Rounded off to one decimal place)

Try it: numerical answer: type the value

Numerical answer. No negative marking.
Show answer and explanation

Answer: 10.2 (official GATE 2023 final answer key)

Concept used: Polling costs time on every poll whether or not there is input; interrupts cost time only per event.

First step: Count polls per second (100) and add the cost of processing one keystroke to get T1T_1.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2023 CS question paper and final answer key, organised by IIT Kanpur. Question paper · Answer key