Definition of polling in I/O handling: Polling means the CPU repeatedly checks device status within the normal instruction flow, not that it pauses execution to run a separate I/O routine automatically.
-
ACorrect: polling is active status checking in the main program flow
-
BIncorrect: polling always pauses to execute an interrupt routine
-
CCorrect only when DMA is enabled
-
DCorrect only in real-time operating systems
-
EApplies only to serial ports
Answer
Correct Answer: Correct: polling is active status checking in the main program flow
Explanation
Introduction / Context:Polling and interrupts are two fundamental I/O servicing methods. Polling is software-driven status checking performed by the CPU at regular intervals or in loops. Interrupts are hardware-driven events that suspend the current instruction stream to service an interrupt handler. This question distinguishes these mechanisms.
Given Data / Assumptions:
- Polling involves reading device status registers to decide when to transfer data.
- Interrupts cause an automatic context switch to a service routine.
- DMA is independent of polling vs. interrupts.
Concept / Approach:In polling, the CPU executes normal code that includes checks like “is transmit buffer empty?” or “has data arrived?” If the condition is met, it performs I/O; otherwise, it continues or waits in a controlled loop. There is no automatic diversion by hardware. In interrupts, hardware signals the CPU to pause the current flow and jump to an ISR, then return after servicing.
Step-by-Step Solution:
Implement a loop that reads a status bit.If set, read/write the data register; if not, continue or check again later.Contrast with interrupts, where the CPU branches to an ISR without explicit polling code at that moment.Verification / Alternative check:Trace program counters: in polling, execution follows the main path; in interrupts, the PC saves the current location and jumps to the ISR upon an interrupt request.
Why Other Options Are Wrong:
- “Pauses to execute an interrupt routine” describes interrupts, not polling.
- “Correct only with DMA/RTOS/serial” imposes irrelevant constraints; polling is general.
Common Pitfalls:Confusing busy-wait polling with blocking delays; assuming polling cannot meet real-time needs (it can, if loop timing is bounded); overlooking CPU usage overhead of continuous polling vs. interrupt efficiency.
Final Answer:Correct: polling is active status checking in the main program flow