In this post, we will understand the difference between interrupt and polling in operating system −
It is a process with the help of which the CPU is notified of requiring attention.
It is considered as a hardware mechanism.
An interrupt handler services/works with the device.
Interrupt-request line indicates that the device needs to be serviced.
CPU is used only when a device requires servicing.
This, in turn, saves the CPU cycles.
An interrupt can occur at any point in time.
It becomes inefficient if devices frequently interrupt the CPU.
The process in which the CPU constantly checks the status of the device- to see if it needs the CPU's attention.
It is a protocol.
In this protocol, the CPU services the device.
The command-ready bit indicates that the device needs to be serviced.
The CPU needs to wait and check if a device needs to be serviced.
This wastes many of the CPU cycles.
CPU polls the devices at regular intervals of time.
This protocol becomes inefficient when the CPU rarely finds a device that is ready to be serviced.