0
0
Operating Systemsknowledge~10 mins

Programmed I/O vs interrupt-driven I/O in Operating Systems - Visual Side-by-Side Comparison

Choose your learning style9 modes available
Concept Flow - Programmed I/O vs interrupt-driven I/O
Start I/O Operation
Programmed I/O?
YesCPU waits and checks device status repeatedly
Data transfer when ready
Interrupt-driven I/O?
YesCPU does other work
Device sends interrupt when ready
Invalid method
End
End
The flow shows two ways CPU handles I/O: Programmed I/O where CPU waits actively, and Interrupt-driven I/O where CPU works and responds when device signals.
Execution Sample
Operating Systems
while (device_not_ready) {
  // wait and check device status
}
read_data_from_device();
This code shows Programmed I/O where CPU waits in a loop checking device readiness before reading data.
Analysis Table
StepCPU ActionDevice Status CheckCPU StateData Transfer
1Check device statusNot readyWaitingNo
2Check device statusNot readyWaitingNo
3Check device statusReadyProceedNo
4Read dataReadyReadingYes
5End---
💡 Device becomes ready at step 3, CPU stops waiting and reads data.
State Tracker
VariableStartAfter 1After 2After 3After 4Final
device_statusNot readyNot readyNot readyReadyReadyReady
CPU_stateIdleWaitingWaitingProceedReadingIdle
Key Insights - 2 Insights
Why does the CPU waste time in Programmed I/O?
Because it keeps checking device status repeatedly (see execution_table steps 1 and 2), it cannot do other work until device is ready.
How does Interrupt-driven I/O improve CPU efficiency?
CPU does other tasks and only stops when device sends an interrupt signal, avoiding constant checking (not shown in programmed I/O table but explained in concept_flow).
Visual Quiz - 3 Questions
Test your understanding
In the execution_table, what is the CPU state at step 2?
AReading
BWaiting
CIdle
DProceed
💡 Hint
Look at the 'CPU State' column in execution_table row for step 2.
At which step does the device become ready according to the execution_table?
AStep 3
BStep 4
CStep 1
DStep 5
💡 Hint
Check the 'Device Status Check' column to find when status changes to 'Ready'.
If the device never becomes ready, what happens to the CPU in Programmed I/O?
ACPU switches to other tasks automatically
BCPU shuts down
CCPU continues waiting indefinitely
DCPU reads data anyway
💡 Hint
Refer to execution_table steps 1 and 2 where CPU waits while device is not ready.
Concept Snapshot
Programmed I/O: CPU waits and checks device status in a loop, blocking other tasks.
Interrupt-driven I/O: CPU does other work and responds only when device sends an interrupt.
Programmed I/O wastes CPU time; interrupt-driven I/O improves efficiency.
Interrupts signal CPU to handle I/O asynchronously.
Use programmed I/O for simple devices; interrupts for multitasking systems.
Full Transcript
This visual execution compares Programmed I/O and Interrupt-driven I/O. Programmed I/O makes the CPU wait actively by checking device status repeatedly until the device is ready, shown in the execution table steps 1 to 3. The CPU state remains waiting until the device signals readiness, then it reads data. Interrupt-driven I/O lets the CPU do other work and only stop when the device sends an interrupt signal, improving efficiency. The variable tracker shows device status and CPU state changes over time. Key moments clarify why programmed I/O wastes CPU time and how interrupts help. The quiz tests understanding of CPU states and device readiness during execution.