OS & Hardware
When is polling, in which the CPU repeatedly checks device status instead of using interrupts, advantageous?
- AWhen events occur at a very high rate and the per-interrupt switching overhead is large
- BWhen events are very rare and the CPU should be used for other work
- CWhen the CPU should sleep as long as possible to minimize power
Show answer and explanation
Answer: A. When events occur at a very high rate and the per-interrupt switching overhead is large
Interrupts avoid wasting the CPU when events are rare, but each one costs state saving and a jump to the handler. When events are extremely frequent, as with high-speed networking, interrupt overhead piles up until processing cannot keep pace, so polling in batches becomes more efficient. For rare events or when the CPU should sleep to save power, spinning on polls is wasteful and interrupts are better.
- A. Correct. For frequent events, polling beats interrupt overhead.
- B. For rare events, polling wastes the CPU.
- C. Polling keeps the CPU busy and increases power.