program interrupts
PC Guides

Information About Interrupts: Software, Hardware and What Are Interrupt Handlers?

Interrupts are one of the most powerful features in computers. Most of the modern computers including Macs have this feature installed within them. But expect people who have good computer background and dealt with subjects like computer organization, many of the common computer users may not be familiar with the term ‘interrupt’. But the thing is it brings to light one of the coolest of tasks your computer performs; and believe me this article is written in plain English and a very soft to understand language. So enjoy reading.

program interrupts

interrupt flow chart

What is interrupt?

An interrupt is a signal or, you can say a request generated by: a peripheral attached to the computer (or) a program within the computer; which is sent to the CPU seeking its attention. It truly goes by the actual dictionary meaning of the word ‘interrupt’ isn’t it? So once the CPU senses an interrupt it immediately stops whatever it is doing and responds to the event that caused the interrupt.


The code that the CPU is working on will be temporarily stored while the CPU attends the interrupt event. And once the interrupt handler (the operating system’s code for handling interrupts also called ISR) is done working on the interrupt event, the CPU resorts back to the previous programs it is working on almost automatically.

Various classes of interrupts

All the interrupts are classified into two main classes:

  • Hardware Interrupt
  • Software Interrupt

Hardware interrupt is triggered when there is any external device which wants to communicate to the computer to achieve certain purpose. For example say keyboard, or a printer.

Software interrupts are sort of pits the programmers have designed in which the control jumps from one set of code to another; these are primarily based on the predetermined instructions in the program. Usually these interrupts run codes which request some resource from the user to continue executing the earlier program.

What are Interrupt Service Routines?

The Interrupt Service Routines (ISR) also called as interrupt handlers are also code which the operating system uses to attend to software or hardware interrupts. Particularly, when there are overlapping interrupts, the interrupt handlers must work at a higher pace with greater precision.


But, What, Exactly Are Overlapping interrupts?

Often it happens that one or more I/O devices act at once. For instance, the movements of mouse immediately followed by a few keystrokes from the keyboard all may happen at same time.

If something like that happens, the interrupt handler chooses between the interrupts and based on their priority and runs that interrupt first. Later immediately after the ISR is done with the first interrupt it now handles the other interrupt.

Also if there is another interrupt while the ISR is busy handling an interrupt, there are two possible situations here:

  • The ISR stops dealing with the first interrupt and the later interrupt will be run first.
  • It may also happen that the ISR completes dealing with the first interrupt and then attends the second interrupt.

The event which occurs during this type of a situation depends on the architecture.

Leave a Reply

Your email address will not be published. Required fields are marked *