OS & Hardware

When is polling, in which the CPU repeatedly checks device status instead of using interrupts, advantageous?

  1. AWhen events occur at a very high rate and the per-interrupt switching overhead is large
  2. BWhen events are very rare and the CPU should be used for other work
  3. 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.
Practice this topic Back to topic

More OS & Hardware questions

  1. In a system where hardware does not keep caches coherent, what must software do before the CPU reads data a device wrote to main memory via DMA?
  2. What is the main role of an IOMMU?
  3. What is the role of a device driver?
  4. Why do typical operating systems prevent applications from directly reading and writing device registers?
  5. What is the software called that runs multiple operating systems simultaneously on one computer, each as an independent virtual machine?