Compare IO based on polling with interruptdriven IO In what
Compare I/O based on polling with interrupt-driven I/O. In what situation would you favor one technique over the other
Solution
Please follow the data and description :
Polling :
It generally means that we are constantly using the maximum of the CPU cycles to check whether any I/O is occurring or not. In the other way, it also means that the CPU is busy waiting on any other task so as to not miss any I/O. On the other hand the interrupt driven I/O operations allows the CPU to work on the relative other tasks and handle the respective requests on demand, but on the other hand it also requires a context switch into the interrupt handler to process it. We basically use the interrupt driven I/O devices for any sort of the human interface device, as it is much slower than the data processing it is doing, so a few hundred interrupts that occur at each second does not come into the count or does not matter to the process. So the polling is used for high bandwidth raw data transfer applications, as a million context switches tends to slow things down.
In this case the OS simply busy waiting on a loop, continuly checking for the I/O, whereas in the interrupt-driven I/O, when an I/O job arrive an interrupt is generated and the OS runs the interupt handler, after that it return to what it was doing before the interrupt came. Now if the cost for interrupt handling is bigger than the time spent busy waiting in polling and the rate of I/O jobs arrive is high then polling is prefered, otherwise the latter options is a better choice.
Hope this is helpful.
