Browse Definitions :
Definition

interrupt

What is an interrupt?

An interrupt is a signal emitted by a device attached to a computer or from a program within the computer. It requires the operating system (OS) to stop and figure out what to do next. An interrupt temporarily stops or terminates a service or a current process. Most I/O devices have a bus control line called Interrupt Service Routine (ISR) for this purpose.

An interrupt signal might be planned (i.e., specifically requested by a program) or it may be unplanned (i.e., caused by an event that may not be related to a program that's currently running on the system).

Today, almost all computing systems are interrupt-driven. What this means is that they follow the list of computer instructions in a program and run the instructions until they get to the end or until they sense an interrupt signal. If the latter event happens, the computer either resumes running the current program or begins running another program. In either case, it must stop operations while deciding on the next action. To do this and to work on other programs, the OS uses pauses in operations.

When the device processor handles interrupts, it informs the device sending the signal that the interrupt request (IRQ) has been recognized. Then the device stops sending the IRQ signal.

An OS usually includes code called an interrupt handler to prioritize interrupts and save them in a queue if more than one is waiting to be handled. It also has a scheduler program that determines the next program that gets control.

When an interrupt occurs, the associated service may not start immediately. The time interval between the time the interrupt occurs and the time when ISR execution starts is called interrupt latency.

Three types of computer instruction formats
Almost all computing today is interrupt-driven, which means they follow a list of instructions in a program and run those until they get to the end or sense an interrupt signal.

Types of interrupts

Interrupts are classified into two types:

I. Hardware interrupt

A hardware interrupt is an electronic signal from an external hardware device that indicates it needs attention from the OS. One example of this is moving a mouse or pressing a keyboard key. In these examples of interrupts, the processor must stop to read the mouse position or keystroke at that instant.

In this type of interrupt, all devices are connected to the Interrupt Request Line (IRL). Typically, a hardware IRQ has a value that associates it with a particular device. This makes it possible for the processor to determine which device is requesting service by raising the IRQ, and then provide service accordingly.

There are three types of hardware interrupts:

Maskable interrupts

In a processor, an internal interrupt mask register selectively enables and disables hardware requests. When the mask bit is set, the interrupt is enabled. When it is clear, the interrupt is disabled. Signals that are affected by the mask are maskable interrupts.

Non-maskable interrupts

In some cases, the interrupt mask cannot be disabled so it does not affect some interrupt signals. These are non-maskable interrupts and are usually high-priority events that cannot be ignored.

Spurious interrupts

Also known as a phantom interrupt or ghost interrupt, a spurious interrupt is a type of hardware interrupt for which no source can be found. These interrupts are difficult to identify if a system misbehaves. If the ISR does not account for the possibility of such interrupts, it may result in a system deadlock.

II. Software interrupts

A software interrupt occurs when an application program terminates or requests certain services from the OS. Usually, the processor requests a software interrupt when certain conditions are met by executing a special instruction. This instruction invokes the interrupt and functions like a subroutine call. Software interrupts are commonly used when the system interacts with device drivers or when a program requests OS services.

In some cases, software interrupts may be triggered unexpectedly by program execution errors rather than by design. These interrupts are known as exceptions or traps.

Interrupts vs. polling

Polling is a state of continuous monitoring where a microcontroller in a computing system continuously checks the status of all devices. The first device encountered with the IRQ bit is serviced first and the appropriate ISR is called to service that device. The system is easy to implement and ensures that the component that needs service gets it.

However, because the microcontroller uses all its processing time for polling, it cannot carry out simultaneous operation. Also, a lot of time is wasted by interrogating the IRQ bit of all devices. Interrupts provide a solution to this problem. With interrupts, the controller does not need to regularly monitor the status of devices. Instead, it responds only when an interrupt occurs. So, when there is an interrupt, the controller is notified that it needs service.

What is an ISR?

An ISR is present for every interrupt. The address of each ISR is stored in a fixed location in memory. An ISR can call for asynchronous interrupts and handle both maskable and non-maskable interrupts.

When an interrupt occurs, the microcontroller runs the ISR. At the start of execution, the ISR disables the interrupt services of all other devices, stopping the instruction that's currently processing and saving its configuration in a register. Then it will load the interrupt's program counter from a location given by the interrupt vector table. Once ISR execution is complete, it will reinitialize all interrupt services.

The two main types of interrupt handlers:

  • First-level interrupt handler (FLIH). A hard or fast interrupt handler that handles maskable interrupts and has jitter during process execution
  • Second-level interrupt handler (SLIH). A slow and soft interrupt handler with less jitter than FLIH

Types of interrupt methods

There are two types of interrupt triggering methods or modules:

Level-triggered interrupts

This interrupt module generates an interrupt by holding the interrupt signal at a particular active logic level. The signal gets negated once the processor commands it after the device has been serviced. The processor samples the interrupt signal during each instruction cycle and recognizes it when it's inserted during the sampling process. After servicing a device, the processor may service other devices before exiting the ISR.

Level-triggered interrupts allow multiple devices to share a common signal using wired-OR connections. However, it can be cumbersome for firmware to deal with them.

Edge-triggered interrupts

This module generates an interrupt only when it detects an asserting edge of the interrupt source. Here, the device that wants to signal an interrupt creates a pulse which changes the interrupt source level.

Edge-triggered interrupts provide a more flexible way to handle interrupts. They can be serviced immediately, regardless of how the interrupt source behaves. Plus, they reduce the complexity of firmware code and reduce the number of conditions required for the firmware. The drawback is that if the pulse is too short to be detected, special hardware may be required to detect and service the interruption.

See also: supervisor call, polled interrupt, embedded system

This was last updated in July 2022

Continue Reading About interrupt

Networking
  • subnet (subnetwork)

    A subnet, or subnetwork, is a segmented piece of a larger network. More specifically, subnets are a logical partition of an IP ...

  • secure access service edge (SASE)

    Secure access service edge (SASE), pronounced sassy, is a cloud architecture model that bundles together network and cloud-native...

  • Transmission Control Protocol (TCP)

    Transmission Control Protocol (TCP) is a standard protocol on the internet that ensures the reliable transmission of data between...

Security
  • cyber attack

    A cyber attack is any malicious attempt to gain unauthorized access to a computer, computing system or computer network with the ...

  • digital signature

    A digital signature is a mathematical technique used to validate the authenticity and integrity of a digital document, message or...

  • What is security information and event management (SIEM)?

    Security information and event management (SIEM) is an approach to security management that combines security information ...

CIO
  • product development (new product development)

    Product development -- also called new product management -- is a series of steps that includes the conceptualization, design, ...

  • innovation culture

    Innovation culture is the work environment that leaders cultivate to nurture unorthodox thinking and its application.

  • technology addiction

    Technology addiction is an impulse control disorder that involves the obsessive use of mobile devices, the internet or video ...

HRSoftware
  • organizational network analysis (ONA)

    Organizational network analysis (ONA) is a quantitative method for modeling and analyzing how communications, information, ...

  • HireVue

    HireVue is an enterprise video interviewing technology provider of a platform that lets recruiters and hiring managers screen ...

  • Human Resource Certification Institute (HRCI)

    Human Resource Certification Institute (HRCI) is a U.S.-based credentialing organization offering certifications to HR ...

Customer Experience
  • contact center agent (call center agent)

    A contact center agent is a person who handles incoming or outgoing customer communications for an organization.

  • contact center management

    Contact center management is the process of overseeing contact center operations with the goal of providing an outstanding ...

  • digital marketing

    Digital marketing is the promotion and marketing of goods and services to consumers through digital channels and electronic ...

Close