Open In App

What is an Interrupt?

Interrupts play a crucial role in computer devices by allowing the processor to react quickly to events or requests from external devices or software. In this article we are going to discuss every point about interruption and its various types in detail, Let’s discuss each:

What is Interrupt?

The interrupt is a signal emitted by hardware or software when a process or an event needs immediate attention. It alerts the processor to a high-priority process requiring interruption of the current working process. In I/O devices one of the bus control lines is dedicated for this purpose and is called the Interrupt Service Routine (ISR)



When a device raises an interrupt at let’s say process i, the processor first completes the execution of instruction i. Then it loads the Program Counter (PC) with the address of the first instruction of the ISR. Before loading the Program Counter with the address, the address of the interrupted instruction is moved to a temporary location. Therefore, after handling the interrupt the processor can continue with process i+1. 

While the processor is handling the interrupts, it must inform the device that its request has been recognized so that it stops sending the interrupt request signal. Also, saving the registers so that the interrupted process can be restored in the future, increases the delay between the time an interrupt is received and the start of the execution of the ISR. This is called Interrupt Latency. 



Types of Interrupt

Event-related software or hardware can trigger the issuance of interrupt signals. These fall into one of two categories: software interrupts or hardware interrupts.

1. Software Interrupts

A sort of interrupt called a software interrupt is one that is produced by software or a system as opposed to hardware. Traps and exceptions are other names for software interruptions. They serve as a signal for the operating system or a system service to carry out a certain function or respond to an error condition. Generally, software interrupts occur as a result of specific instructions being used or exceptions in the operation. In our system, software interrupts often occur when system calls are made. In contrast to the fork() system call, which also generates a software interrupt, division by zero throws an exception that results in the software interrupt.

A particular instruction known as an “interrupt instruction” is used to create software interrupts. When the interrupt instruction is used, the processor stops what it is doing and switches over to a particular interrupt handler code. The interrupt handler routine completes the required work or handles any errors before handing back control to the interrupted application.

2. Hardware Interrupts

In a hardware interrupt, all the devices are connected to the Interrupt Request Line. A single request line is used for all the n devices. To request an interrupt, a device closes its associated switch. When a device requests an interrupt, the value of INTR is the logical OR of the requests from individual devices. 

Hardware interrupts are further divided into two types of interrupt

Sequences of Events Involved in Handling an IRQ(Interrupt Request)

Managing Multiple Devices

When more than one device raises an interrupt request signal, then additional information is needed to decide which device to be considered first. The following methods are used to decide which device to select: Polling, Vectored Interrupts, and Interrupt Nesting. These are explained below. 

Processors’ priority is encoded in a few bits of PS (Process Status register). It can be changed by program instructions that are written into the PS. The processor is in supervised mode only while executing OS routines. It switches to user mode before executing application programs.

What is Interrupt Latency?

The amount of time between the generation of an interrupt and its handling is known as interrupt latency. The number of created interrupts, the number of enabled interruptions, the number of interrupts that may be handled, and the time required to handle each interrupt all affect interrupt latency. When the device generating the interrupt needs a specific length of time to generate the interrupt, interrupt latency is required. For instance, if a printer is printing paper, the computer needs to stop the printing program and wait for the document to finish printing. The interrupt latency is the amount of time the computer has to stop the program from operating.

How CPU React when Interrupt occurs

Triggering Methods

Every interrupt signal input is intended to be activated by a certain signal edge (level change) or a logic signal level. Level-sensitive inputs make constant requests for processor attention as long as they are treated with a specific logic level (high or low). Edge-sensitive inputs are responsive to signal edges; a service request will latch on to a specific (rising or falling) edge. When the interrupt handler runs, the CPU resets the latch.

Benefits of Interrupt

Conclusion

Frequently Asked Questions on Interrupt – FAQs

How are interrupts handled in the system?

An interrupt handler is a specialised piece of software that manages interruptions on a computer. On a computer, many interrupt handlers may be installed. The type of interrupt that is created determines which interrupt handler the CPU executes.

Can interruptions be prioritized?

Yes interrupts be prioritized.

What is the interrupt vector table?

The interrupt vector table, also known as the IV or IVT, is a list of functions that the CPU has linked to handle particular exceptions including faults, interrupt requests from peripherals, and system service requests from the application.

What are nested interrupts?

Whenever an ISR is being executed, an interrupt is permitted at any time and anywhere in a hierarchical interrupt system. However, only the most urgent ISRs would be carried out right away. After the highest priority ISR is finished, the second-highest priority one will be carried out. this is know as nested interrupt.


Article Tags :