What if your computer could stop wasting time waiting and start working smarter instead?
Programmed I/O vs interrupt-driven I/O in Operating Systems - When to Use Which
Imagine you are waiting by the phone, staring at it constantly to catch a call. You can't do anything else because you must answer immediately when it rings.
This constant waiting wastes your time and energy. You might miss other important tasks because you are stuck watching the phone. It is tiring and inefficient.
Now imagine the phone rings and instead of you watching it, a friend taps your shoulder to tell you. You can focus on your work and only respond when needed. This is how interrupt-driven I/O works, making the system more efficient.
while (device_not_ready()) { /* keep checking */ } read_data();enable_interrupt(); // CPU does other tasks
on_interrupt() { read_data(); }This approach lets the computer do many things at once, improving speed and saving energy.
When you type on a keyboard, the computer doesn't watch the keyboard all the time. Instead, it waits for a signal (interrupt) when a key is pressed, then processes it.
Programmed I/O wastes time by constant checking.
Interrupt-driven I/O notifies the CPU only when needed.
Interrupts improve efficiency and multitasking.