🎓 BookMCQ
← Back to 13. I/O Systems

📝 Polling in I/O Hardware (13 MCQs)

Polling as a Method of Checking Device Status

Polling is an I/O control technique in which the processor repeatedly checks a device controller's status register to determine whether an operation can proceed or has completed. The operating system or driver reads the register and tests relevant status bits. Polling provides a direct method of coordinating with hardware without requiring a separate interrupt for every status change.

Why Repeated Status Checks Are Sometimes Used

Some devices or operations require predictable, closely controlled interaction. Polling avoids interrupt setup and handling overhead, particularly when an event is expected very soon or occurs frequently. However, a processor that repeatedly checks a slow device can waste execution time that could otherwise be used for other processes.

Reading Status Bits and Repeating the Check

The driver initiates a device operation by writing to its control register. It then reads the status register in a loop, testing whether a ready, busy, or completion bit has changed. The loop continues until the required condition occurs or a timeout or error condition causes the operation to stop.

Example of Waiting for a Device to Become Ready

Suppose a controller reports busy while a printer prepares a job. The driver checks its status register repeatedly. After 8 milliseconds, the ready bit becomes set, so the driver writes the next command or data. During the waiting interval, the CPU performs repeated checks rather than running an unrelated process through interrupt-based waiting.

CPU Utilisation and Suitable Workloads

Polling can provide low response latency when devices are fast and events occur frequently. It is often appropriate for short waits, embedded control loops, and high-performance systems that dedicate processing resources to device management. Long waits increase CPU overhead and reduce efficiency, making interrupt-driven approaches preferable when events are infrequent or unpredictable.

Misconceptions About Polling Behaviour

'Polling notifies the CPU when a device changes state' is incorrect because the CPU discovers changes by reading status. 'Polling always uses less CPU time than interrupts' ignores repeated checking during long waits. 'A polling loop must continue forever' is false because drivers can use timeouts and error handling to terminate unsuccessful operations.

Exam Focus: Polling Versus Interrupt Driven I/O

Be able to trace a polling loop using busy, ready, and completion status bits. Compare its CPU cost and response time with interrupt-driven I/O. Questions may provide device delays and ask why repeated checking wastes processor time, or under which conditions polling can still be a suitable choice.

Key Terms of Polling

  • Polling - Repeatedly checking device status.
  • Status register - Reports device operating conditions.
  • Ready bit - Indicates readiness for an operation.
  • Busy bit - Indicates an ongoing device operation.
  • Timeout - Limit on an operation's waiting period.
3
Easy
7
Medium
3
Hard

📝 All Polling in I/O Hardware MCQs

Q1. What is the primary purpose of polling in computer I/O?

A.Continuously checking a device's status ✅
B.Sending interrupt signals
C.Allocating memory
D.Encrypting data
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Polling repeatedly queries a device to see if it needs service. This matches option A, which describes continuously checking status. Options B, C, and D describe unrelated functions: interrupts are a different mechanism, memory allocation is unrelated to I/O, and encryption is not a polling task. In real systems, the CPU uses polling loops to monitor keyboards or sensors, ensuring the device is ready before data transfer.

Q2. Why might a system designer choose polling over interrupts for a low‑speed peripheral?

A.Polling provides deterministic timing and requires only simple hardware
B.Polling always yields faster response than interrupts ✅
C.Polling reduces overall CPU usage
D.Polling enables parallel processing of multiple devices
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Option B is correct because a simple hardware design and predictable timing are the main reasons to favor polling for slow devices. Options A, C, and D are inaccurate: polling does not guarantee faster response than interrupts, it usually increases CPU usage because the CPU must repeatedly check the device, and it does not inherently allow parallel processing. Designers value the simplicity and timing certainty in many embedded contexts.

Q3. How does a daisy‑chain configuration affect the polling process for multiple devices on the same bus?

A.It allows the CPU to poll each device sequentially using the same port
B.It requires each device to generate its own interrupt
C.It eliminates the need for polling entirely ✅
D.It forces devices to operate at the same speed
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The correct answer is C because in a daisy‑chain the devices share a single connection point, so the CPU must query them one after another using the same port. Option A incorrectly suggests simultaneous polling, which the bus cannot support. Option B describes interrupt behavior, not polling. Option D is unrelated; devices can run at different speeds even in a chain. This sequential checking is typical when monitoring multiple sensors on a shared line.

Q4. In a system where both polling and interrupt mechanisms are available, which factor most influences the decision to use polling for a specific device?

A.Device's data rate and predictability
B.Amount of available RAM
C.Number of CPU cores
D.Color depth of the display ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Option D is correct because the data rate and predictability of the device determine whether polling will meet timing requirements without wasting CPU cycles. Options A, B, and C refer to resources that do not directly affect the polling choice: RAM size and CPU core count are generally irrelevant, and display color depth has no bearing on I/O polling strategies. Engineers weigh the device's speed and regularity when selecting a polling approach.

Q5. Consider a bus that supports both DMA and polling. Why might polling still be preferred for a device that transfers small, irregular packets?

A.Overhead of setting up DMA outweighs benefits for tiny transfers ✅
B.Polling can compress data better
C.DMA cannot operate on that bus type
D.Polling automatically encrypts the packets
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Option A is correct because DMA setup time can dominate the transfer time when packets are very small, making simple polling more efficient. Options B, C, and D are false: polling does not perform compression, DMA can operate on many bus types, and polling does not provide encryption. In practice, embedded controllers often poll low‑volume sensors rather than invoke DMA for each tiny read.

Q6. When multiple devices share a serial port via a bus, what is a key limitation of polling that can lead to missed data?

A.The CPU may not poll fast enough to catch brief status changes
B.Polling increases the voltage on the bus ✅
C.Polling changes the baud rate dynamically
D.Polling requires devices to be powered off
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Option B is correct because if the CPU's polling interval is longer than the window during which a device signals readiness, the change can be missed, causing data loss. Options A, C, and D are inaccurate: polling does not alter voltage levels, does not modify baud rates, and certainly does not power devices off. Real‑world implementations must choose a polling frequency that captures all transient signals.

Q7. A microcontroller monitors a temperature sensor that updates its reading every second. Which polling interval is most appropriate to ensure the latest temperature is read without unnecessary CPU load?

A.Every 0.5 seconds
B.Every 1 second
C.Every 5 seconds ✅
D.Every 10 seconds
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Option C is correct because polling once per second matches the sensor’s update rate, guaranteeing the newest value while avoiding extra checks. Option A would waste CPU cycles by polling twice as often, while options D and B are too infrequent to capture every new reading. Matching the poll interval to the sensor’s refresh period is a common practice in low‑power embedded designs.

Q8. An embedded system uses polling to read status from four LEDs arranged in a daisy‑chain. If the CPU can perform 2000 poll cycles per second, what is the maximum polling frequency for each LED?

A.2000 Hz
B.1000 Hz
C.500 Hz
D.250 Hz ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Option D is correct because the CPU’s 2000 cycles are divided among four LEDs, giving 20004=500\frac{2000}{4}=500 cycles per second per LED, which corresponds to 500 Hz (option C). However, the maximum frequency each LED can be individually polled without exceeding the total is 500 Hz, so the correct answer is option C. Options A and B overstate the capability, and option D understates it.

Q9. A PC must poll a legacy serial printer that can accept a new line only after it signals ready. If the printer becomes ready for 2 ms every 20 ms, what is the minimum polling interval that guarantees the ready signal is captured?

A.1 ms ✅
B.2 ms
C.5 ms
D.10 ms
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Option A is correct because the CPU must poll at least as frequently as the shortest ready window, which is 2 ms; polling every 1 ms ensures the ready state is seen. Option B matches the window length but would risk missing the moment if the poll occurs just after the window closes. Options C and D are too slow, allowing the ready signal to be missed entirely. In practice, designers choose a poll interval shorter than the device’s active window.

Q10. A developer designs a polling loop for a USB hub that connects ten low‑speed devices. Each poll of a device takes 0.2 ms. To keep the loop under 5 ms, how many devices can be safely polled each cycle?

A.5
B.10 ✅
C.15
D.20
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Option B is correct because the total time for ten devices is 10×0.2 ms=2 ms10 \times 0.2\,\text{ms}=2\,\text{ms}, well below the 5 ms budget, allowing all ten to be polled each cycle. Option A would underutilize the available time, while options C and D exceed the 5 ms limit (3 ms and 4 ms respectively) if more devices were added, but the scenario only has ten devices. Thus polling all ten fits comfortably within the time constraint.

Q11. In a flight simulator, the joystick must be polled to update control surfaces. If the simulator runs at 60 frames per second, what is the latest time (in ms) the polling must occur each frame to avoid noticeable lag?

A.5 ms
B.10 ms
C.16 ms ✅
D.33 ms
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Option C is correct because one frame at 60 fps lasts 1000 ms60≈16.7 ms\frac{1000\,\text{ms}}{60}\approx16.7\,\text{ms}; polling must finish within that period, so 16 ms is the practical limit. Options A and B are more restrictive than necessary, while option D exceeds the frame duration, causing visible lag. Real‑time simulations often align input polling with the frame budget to maintain responsive controls.

Q12. A network card uses polling to check for incoming packets. If each packet arrival triggers a poll that takes 0.1 ms and the average packet rate is 800 packets per second, what fraction of CPU time is consumed by polling?

A.0.04
B.0.08
C.0.12
D.0.16 ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Option D is correct because the total polling time per second is 800×0.1 ms=80 ms800 \times 0.1\,\text{ms}=80\,\text{ms}, which is 801000=0.08\frac{80}{1000}=0.08 or 8 % of a second, corresponding to option B. However, the question asks for the fraction, and 8 % is the correct value, so option B should be selected. Options A and C represent incorrect percentages, and option D is double the actual usage.

Q13. A real‑time control system must poll three sensors with periods of 2 ms, 5 ms, and 10 ms respectively. The CPU can perform a poll in 0.1 ms. Determine whether a feasible schedule exists that polls each sensor at its required period without overlap, and identify the maximum CPU utilization.

A.No feasible schedule
B.Feasible, 8 % utilization ✅
C.Feasible, 12 % utilization
D.Feasible, 20 % utilization
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Option B is correct. Within the least common multiple of the periods (10 ms), sensor 1 needs 5 polls, sensor 2 needs 2, and sensor 3 needs 1, totaling 8 polls. At 0.1 ms each, the CPU uses 0.8 ms per 10 ms, yielding 8 % utilization and no overlap. Options A, C, and D either claim impossibility or overestimate CPU load, which would not reflect the calculated schedule.

🔗 Related Topics (MCQs)