Compare I/O based on polling with interrupt-driven I/O. In what situation would you
favour one technique over the other?
Answer:
-Polling means that we are continually using CPU cycles to check whether any I/O is occurring or not. However, it means the CPU is busy-waiting on any other task so as to not miss any I/O. Interrupt-driven I/O allows the CPU to work on other tasks and handle requests on demand, however it requires a context switch into the interrupt handler to process it. We normally favour interrupt-driven I/O for any sort
of human interface device, as it is much slower than the data processing it is doing, so a few hundred interrupts each second won’t matter. We might favour polling for high bandwidth raw data transfer applications, as a million context switches tends to slow things down