GATE / CS ARCHIVE

GATE CSE 2023 / QUESTION 34

GATE CSE 2023 Q34

Computer Organization & Architecture · Input/Output, DMA & Interrupts · Full GATE CSE 2023 paper

GATE 2023, Q34 1 mark · NAT
Report issue

Input/Output, DMA & Interrupts

Question 34, GATE 2023: A keyboard produces one keystroke per second. Polling every 10 ms costs 100 μs per poll plus 200 μs per detected keystroke; its CPU-time fraction is T1. Interrupt handling and processing together cost 1 ms per keystroke; its fraction is T2. Find T1/T2 to one decimal place.
Tap to enlarge
Answer & solution

Official answer: 10.2

Polling every 10 ms means 100 polls per second, consuming 100×100μs=10000μs. Processing one keystroke adds 200μs, giving T1=10200μs/second. Interrupt-based processing consumes 1ms=1000μs per second, so T1/T2=10200/1000=10.2.

Teaching detail. Keep all quantities in the same unit before taking the ratio. Each second contains 1000/10=100 polling intervals, even though only one of those intervals typically detects a keystroke. Poll overhead is therefore paid 100 times, whereas keystroke processing is paid once. The fractions are T1=0.0102 and T2=0.001, and division gives 10.2. The interrupt approach's larger cost per event can still be much cheaper overall because it avoids 99 unproductive polling checks.

Original paper, page 32 · Answer key