- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between Interrupt and Polling in OS
An operating system acts as a bridge between the hardware and applications. The CPU is that part of the system which handles all the tasks of the system. Sometime such situations arise, when it is required to interrupt the currently running task and take a rapid action. Therefore, in operating system, there are two methods namely interrupt and polling for dealing with such events. In both interrupt and polling, the CPU is paused what it is doing and made to execute an essential task.
Both interrupt and polling are quite different from each other in several ways. In this article, we will discuss the important differences between interrupt and polling.
What is Interrupt?
A signal to the CPU to take an immediate action is called an interrupt. Thus, interrupt is a process with the help of which the CPU is notified of requiring attention. The interrupt is considered as a hardware mechanism. The interrupt requires the operating system to stop and figure out what to do next.
Whenever an interrupt occurs, the CPU stops executing the current program. Then, it comes to the control of interrupt handler or interrupt service routine. There are two types of interrupts namely − hardware interrupts and software interrupts.
The interrupt signals generated from external devices and I/O devices and interrupts to the CPU are called hardware interrupts. On the other hand, the interrupts signals produced from internal devices and software programs are called software interrupts. Interrupts reduce the idle time of the CPU.
What is Polling?
The process in which the CPU constantly checks the status of the device- to see if it needs the CPU's attention is called polling. It is basically a protocol in which the CPU services the I/O devices. Thus, the polling is the process of periodically checking status of a device to see if it is time for the next I/O operation.
Most of the time, devices do not require continuous attention and when one does, it will have to wait until it is next asked by the polling program. As a result, much of the CPU’s time is wasted on unnecessary polls. Hence, it is an inefficient method.
Difference between Interrupt and Polling
The following table highlights all the important differences between interrupt and polling in operating systems −
|An interrupt is a process with the help of which the CPU is notified of requiring attention.||Polling is the process in which the CPU constantly checks the status of a device to see if it needs the CPU's attention.|
|It is considered as a hardware mechanism.||It is a protocol.|
|An interrupt handler services/works with the device.||In this protocol, the CPU services the device.|
|Interrupt-request line indicates that the device needs to be serviced.||The command-ready bit indicates that the device needs to be serviced.|
|CPU is used only when a device requires servicing.||The CPU needs to wait and check if a device needs to be serviced.|
|Interrupts save the CPU cycles.||Polling wastes many of the CPU cycles.|
|Interrupts can occur at any point in time.||CPU polls the devices at regular intervals of time.|
|It becomes inefficient if devices frequently interrupt the CPU.||Polling becomes inefficient when the CPU rarely finds a device that is ready to be serviced.|
The most significant difference that you should note here is that an interrupt is treated as a hardware mechanism, while polling is a protocol in which the processor constantly checks the status of devices.
Kickstart Your Career
Get certified by completing the courseGet Started