Interrupt
Interrupt
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,e., 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
External Interrupts
External interrupts come from input-output (l/0) devices, from a timing device, from a circuit
monitoring the power supply, or from any other external source. The timeout interrupt can result
from a program that is in an endless loop and thus exceeded its time allocation. Power failure
interrupt can have as its service routine a program that transfers the complete state of the CPU into
a non-destructive memory in a few milliseconds before power ceases.
Internal Interrupts
Internal interrupts arise from illegal or erroneous use of an instruction or data. Internal interrupts
are also called traps. These error conditions generally appear as a result of premature termination
of the instruction execution. The service program that processes the internal interrupt determines
the corrective measure to be taken.
The main difference between internal and external interrupts is that the internal interrupt is initiated
by some exceptional condition caused by the program itself rather than by an external event.
Internal interrupts are synchronous with the program while external interrupts are asynchronous.
If the program is rerun, the internal interrupts will appear in the same place each time. External
interrupts depend on external conditions that are independent of the program being executed at the
time.
Software Interrupts
• Step 1:- Any time that an interrupt is raised, it may either be an I/O interrupt or a system
interrupt.
• Step 2:- The current state comprising registers and the program counter is then stored in order
to conserve the state of the process.
• Step 3:- The current interrupt and its handler is identified through the interrupt vector table
in the processor.
• Step 4:- This control now shifts to the interrupt handler, which is a function located in the
kernel space.
• Step 5:- Specific tasks are performed by Interrupt Service Routine (ISR) which are essential
to manage interrupt.
• Step 6:- The status from the previous session is retrieved so as to build on the process from
that point.
• Step 7:- The control is then shifted back to the other process that was pending and the normal
process continues.
Interrupt Latency
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.
• Level-Trigger: The interrupt signal must be held at its specific active logic level (high or
low) to request a level-triggered interrupt. A level-triggered interrupt is triggered when a
device drives the signal to the active level and maintains it there. When the CPU instructs it
to do so, usually after the device has been serviced, it denies the signal.
• Edge-Trigger: An interrupt that is caused by a level change on the interrupt line—either a
rising or lowering edge—is known as an edge-triggered interrupt (low to high). A pulse is
driven onto the line and released to its inactive state by a device that wishes to indicate an
interrupt. It can be necessary to use specialized hardware to detect the pulse if polled I/O is
unable to pick it up due to its short duration.
Benefits of Interrupt
• Real-time Responsiveness: Interrupts permit a system to reply promptly to outside events
or signals, permitting real-time processing.
• Efficient Resource usage: Interrupt-driven structures are more efficient than system that
depend on busy-waiting or polling strategies. Instead of continuously checking for the
incidence of event, interrupts permit the processor to remain idle until an event occurs,
conserving processing energy and lowering energy intake.
• Multitasking and Concurrency: Interrupts allow multitasking with the aid of allowing a
processor to address multiple tasks concurrently.
• Improved system Throughput: By coping with occasions asynchronously, interrupts allow
a device to overlap computation with I/O operations or other responsibilities, maximizing
system throughput and universal overall performance.