Interrupts

An interrupt is a signal to the processor emitted by hardware or software indicating an occurrence of an event that needs immediate attention.The processor responds by suspending its current activities, saving its state, and executing a small program called an interrupt handler (or interrupt service routine, ISR) to deal with the event. This interruption is temporary, and after the interrupt handler finishes, the processor resumes execution of the previous thread. 

 
Interrupt signals can come from a variety of sources. 
For example, every keystroke generates an interrupt signal. Interrupts can also be generated by other devices, such as a printer, to indicate that some event has occurred.
 
Hardware and Software Interrupts
Interrupts initiated by the Hardware are called Hardware Interrupts and Interrupts initiated by the programs are called Software Interrupts.
 A software interrupt is also called a trap or an exception.
 
 Hardware Interrupts  Software Interrupts
A hardware interrupt is an electronic alerting signal sent to the processor from an external device, either a part of the computer itself such as a disk controller or an external peripheral. A software interrupt is caused either by an exceptional condition in the processor itself, or a special instruction in the instruction set which causes an interrupt when it is executed.
Hardware interrupts are asynchronous and can occur in the middle of instruction execution, requiring additional care in programming. Software  interrupts are synchronous, if run the same program again the Interrupt will again occur at the same point of execution.
 The act of initiating a hardware interrupt is referred to as an interrupt request (IRQ). Software interrupt instructions function similarly to subroutine calls and are used for a variety of purposes, such as to request services from low level system software such as device drivers.
For example, pressing a key on the keyboard or moving the mouse triggers hardware interrupts that cause the processor to read the keystroke or mouse position. For example, if the processor’s arithmetic logic unit is commanded to divide a number by zero, this impossible demand will cause a divide-by-zero exception, perhaps causing the computer to abandon the calculation or display an error message.
Each interrupt has its own interrupt handler. The number of hardware interrupts is limited by the number of interrupt request (IRQ) lines to the processor, but there may be hundreds of different software interrupts.
 
The complete list of interrupts and associated interrupt handlers is stored in a table called the interrupt vector table
 
Interrupts can be categorized into these different types:
  • Maskable interrupt (IRQ): a hardware interrupt that may be ignored by setting a bit in an interrupt mask register’s (IMR) bit-mask.
  • Non-maskable interrupt (NMI): a hardware interrupt that lacks an associated bit-mask, so that it can never be ignored. NMIs are used for the highest priority tasks such as timers, especially watchdog timers.
  • Inter-processor interrupt (IPI): a special case of interrupt that is generated by one processor to interrupt another processor in a multiprocessor system.
  • Software interrupt: an interrupt generated within a processor by executing an instruction. Software interrupts are often used to implement system calls because they result in a subroutine call with a CPU ring level change.
  • Spurious interrupt: a hardware interrupt that is unwanted. They are typically generated by system conditions such as electrical interference on an interrupt line or through incorrectly designed hardware.
Interrupt Storm
The phenomenon where the overall system performance is severely hindered by excessive amounts of processing time spent handling interrupts is called an interrupt storm.
 
Vectored and Polled Interrupt
Vectored Interrupts are type of I/O interrupts in which the device that generates the interrupt request (also called IRQ in some text books) identifies itself directly to the processor.
 
A Polled interrupt is a certain kind I/O interrupt that sends a message to the part of the computer that houses the I/O interface. The message states that a device is ready to be accessed without identifying which device.
Rate this post

Leave a Reply