GATE / CS ARCHIVE

SIMILAR QUESTIONS / COMPUTER ORGANIZATION & ARCHITECTURE

Compare polling and interrupt CPU occupation

2 questions solved the same way, newest first. Back to Computer Organization & Architecture

How these are solved

Compute time occupied per second by interrupt handling and polling, then take the requested gain/ratio. 2005 treats continuous program-controlled polling with negligible data-transfer time;

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

2 marks · MCQ
Report issue

Interrupt overhead versus polling

Input/Output, DMA & Interrupts

Question 69, GATE 2005: A10 KB/s device transfers bytes individually. Interrupt overhead 4 microseconds; byte-transfer time to CPU/memory negligible. Minimum intended performance gain using interrupts rather than program-controlled polling? A15; B25; C35; D45. Interpret as CPU occupation ratio and state unit convention.
Question 69, GATE 2005: A10 KB/s device transfers bytes individually. Interrupt overhead 4 microseconds; byte-transfer time to CPU/memory negligible. Minimum intended performance gain using interrupts rather than program-controlled polling? A15; B25; C35; D45. Interpret as CPU occupation ratio and state unit convention.
Tap to enlarge
Your answer
Answer & solution

Answer: B, approximately 25 (no official key was published)

Polling occupies the CPU throughout the interval between consecutive bytes. Using the decimal convention 10 KB/s=10000 bytes/s, this interval is 100 microseconds, whereas interrupt servicing costs 4 microseconds. CPU-time cost ratio is 100/4=25, option B. This compares CPU occupation, not device throughput, which is unchanged. With binary KB the exact ratio is 1/(10240×4×10−6)=24.4140625; 25 is the intended rounded/conventional option.

At 10000 bytes/s a byte arrives every 100 microseconds. Polling continually tests readiness and occupies the CPU for that whole interval. Interrupt service instead occupies only 4 microseconds per byte; the rest can run unrelated work. Their CPU cost ratio is 100/4=25. This is not a 25-fold faster physical device. Binary KB changes the exact ratio, hence the declared convention matters.

Original paper, page 9