HOME

TheInfoList




In
digital computer A computer is a machine A machine is a man-made device that uses power to apply forces and control movement to perform an action. Machines can be driven by animals and people A people is a plurality of person A person (plural ...
s, an interrupt is a response by the
processor
processor
to an event that needs attention from the software. An interrupt condition alerts the processor and serves as a request for the processor to interrupt the currently executing code when permitted, so that the event can be processed in a timely manner. If the request is accepted, the processor responds by suspending its current activities, saving its
state State may refer to: Arts, entertainment, and media Literature * ''State Magazine'', a monthly magazine published by the U.S. Department of State * The State (newspaper), ''The State'' (newspaper), a daily newspaper in Columbia, South Carolina, Un ...
, and executing a
function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern comp ...
called an ''
interrupt handler In computer systems programming, an interrupt handler, also known as an interrupt service routine or ISR, is a special block of code associated with a specific interrupt In digital computers, an interrupt is a response by the central processi ...
'' (or an interrupt service routine, ISR) to deal with the event. This interruption is temporary, and, unless the interrupt indicates a fatal error, the processor resumes normal activities after the interrupt handler finishes. Interrupts are commonly used by hardware devices to indicate electronic or physical state changes that require attention. Interrupts are also commonly used to implement
computer multitasking In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and s ...
, especially in
real-time computing Real-time computing (RTC) is the computer science term for Computer hardware, hardware and computer software, software systems subject to a "real-time constraint", for example from Event (synchronization primitive), event to Event (computing), sys ...
. Systems that use interrupts in these ways are said to be interrupt-driven.


Types

Interrupt signals may be issued in response to
hardware Hardware may refer to: Technology Computing and electronics * Computer hardware, physical parts of a computer * Digital electronics, electronics that operate on digital signals * Electronic component, device in an electronic system used to affect e ...

hardware
or
software Software is a collection of Instruction (computer science), instructions that tell a computer how to work. This is in contrast to Computer hardware, hardware, from which the system is built and actually performs the work. At the low level lang ...

software
events. These are classified as hardware interrupts or software interrupts, respectively. For any particular processor, the number of interrupt types is limited by the architecture.


Hardware interrupts

A hardware interrupt is a condition related to the state of the hardware that may be signaled by an external hardware device, e.g., an
interrupt request In a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as Computer program, programs. These prog ...
(IRQ) line on a PC, or detected by devices embedded in processor logic (e.g., the CPU timer in IBM System/370), to communicate that the device needs attention from the
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
(OS) or, if there is no OS, from the "bare-metal" program running on the CPU. Such external devices may be part of the computer (e.g.,
disk controller The disk controller is the controller circuit which enables the CPU to communicate with a hard disk, floppy disk or other kind of disk drive. It also provides an interface between the disk drive and the bus connecting it to the rest of the sys ...
) or they may be external
peripheral A peripheral or peripheral device is an auxiliary device used to put information into and get information out of the computer. The term peripheral device refers to all hardware components that are attached to a computer and are controlled by the co ...
s. For example, pressing a keyboard key or moving a
mouse A mouse, plural mice, is a small mammal Mammals (from Latin language, Latin , 'breast') are a group of vertebrate animals constituting the class (biology), class Mammalia (), and characterized by the presence of mammary glands which ...
plugged into a
PS/2 The Personal System/2 or PS/2 is IBM International Business Machines Corporation (IBM) is an American multinational technology company headquartered in Armonk, New York, with operations in over 170 countries. The company began in 1911, ...
port triggers hardware interrupts that cause the processor to read the keystroke or mouse position. Hardware interrupts can arrive
asynchronous Asynchrony is the state of not being in synchronization. Asynchrony or asynchronous may refer to: Electronics and computing * Asynchrony (computer programming), the occurrence of events independent of the main program flow, and ways to deal with ...
ly with respect to the processor clock, and at any time during instruction execution. Consequently, all hardware interrupt signals are conditioned by synchronizing them to the processor clock, and acted upon only at instruction execution boundaries. In many systems, each device is associated with a particular IRQ signal. This makes it possible to quickly determine which hardware device is requesting service, and to expedite servicing of that device. On some older systems all interrupts went to the same location and the OS used a specialized instruction to determine the highest priority unmasked interrupt outstanding. On contemporary systems there is generally a distinct interrupt routine for each type of interrupt or for each interrupt source, often implemented as one or more
interrupt vector table An interrupt vector table (IVT) is a data structure Image:Hash table 3 1 1 0 1 0 0 SP.svg, 315px, A data structure known as a hash table. In computer science, a data structure is a data organization, management, and storage format that enables ...
s.


Masking

Processors typically have an internal ''interrupt mask'' register which allows selective enabling and disabling of hardware interrupts. Each interrupt signal is associated with a bit in the mask register; on some systems, the interrupt is enabled when the bit is set and disabled when the bit is clear, while on others, a set bit disables the interrupt. When the interrupt is disabled, the associated interrupt signal may be ignored by the processor or may remain pending. Signals which are affected by the mask are called ''maskable interrupts''. Some interrupt signals are not affected by the interrupt mask and therefore cannot be disabled; these are called ''non-maskable interrupts'' (NMI). NMIs indicate high priority events which cannot be ignored under any circumstances, such as the timeout signal from a
watchdog timer A watchdog timer (sometimes called a ''computer operating properly'' or ''COP'' timer, or simply a ''watchdog'') is an electronic or software timer Timer is a specialized type of clock A clock or a timepiece is a device used to Meas ...
. To ''mask'' an interrupt is to disable it, while to ''unmask'' an interrupt is to enable it.


Spurious interrupts

A ''spurious interrupt'' is a hardware interrupt for which no source can be found. The term "phantom interrupt" or "ghost interrupt" may also used to describe this phenomenon. Spurious interrupts tend to be a problem with a wired-OR interrupt circuit attached to a level-sensitive processor input. Such interrupts may be difficult to identify when a system misbehaves. In a wired-OR circuit,
parasitic capacitance Parasitic capacitance, or stray capacitance is an unavoidable and usually unwanted capacitance Capacitance is the ratio of the amount of electric charge Electric charge is the physical property of matter that causes it to experience a force ...
charging/discharging through the interrupt line's bias resistor will cause a small delay before the processor recognizes that the interrupt source has been cleared. If the interrupting device is cleared too late in the interrupt service routine (ISR), there won't be enough time for the interrupt circuit to return to the quiescent state before the current instance of the ISR terminates. The result is the processor will think another interrupt is pending, since the voltage at its interrupt request input will be not high or low enough to establish an unambiguous internal logic 1 or logic 0. The apparent interrupt will have no identifiable source, hence the "spurious" moniker. A spurious interrupt may also be the result of electrical anomalies due to faulty circuit design, high
noise Noise is unwanted sound In physics, sound is a vibration that propagates as an acoustic wave, through a transmission medium such as a gas, liquid or solid. In human physiology and psychology, sound is the ''reception'' of such waves and the ...
levels,
crosstalk In electronics The field of electronics is a branch of physics and electrical engineering that deals with the emission, behaviour and effects of electrons The electron is a subatomic particle In physical sciences, subatomic particl ...
, timing issues, or more rarely, device errata. A spurious interrupt may result in system deadlock or other undefined operation if the ISR doesn't account for the possibility of such an interrupt occurring. As spurious interrupts are mostly a problem with wired-OR interrupt circuits, good programming practice in such systems is for the ISR to check all interrupt sources for activity and take no action (other than possibly logging the event) if none of the sources is interrupting.


Software interrupts

A software interrupt is requested by the processor itself upon executing particular instructions or when certain conditions are met. Every software interrupt signal is associated with a particular interrupt handler. A software interrupt may be intentionally caused by executing a special instruction which, by design, invokes an interrupt when executed. Such instructions function similarly to
subroutine call In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a specific task. Programming involves tasks such as: analysis, generati ...
s and are used for a variety of purposes, such as requesting operating system services and interacting with
device driver In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and softwa ...
s (e.g., to read or write storage media). Software interrupts may also be unexpectedly triggered by program execution errors. These interrupts typically are called ''
trap A trap is a Trapping#Trap_types, mechanical device used to capture or restrain an animal for purposes such as hunting, pest control, or ecological research. Trap or TRAP may also refer to: Art and entertainment Films and television * Trap (201 ...
s'' or '' exceptions''. For example, a divide-by-zero exception will be "thrown" (a software interrupt is requested) if the processor executes a divide instruction with divisor equal to zero. Typically, the operating system will catch and handle this exception.


Triggering methods

Each interrupt signal input is designed to be triggered by either a logic signal level or a particular signal edge (level transition). Level-sensitive inputs continuously request processor service so long as a particular (high or low) logic level is applied to the input. Edge-sensitive inputs react to signal edges: a particular (rising or falling) edge will cause a service request to be latched; the processor resets the latch when the interrupt handler executes.


Level-triggered

A ''level-triggered interrupt'' is requested by holding the interrupt signal at its particular (high or low) active
logic level In digital circuitIn theoretical computer science, a circuit is a model of computation in which input values proceed through a sequence of gates, each of which computes a function. Circuits of this kind provide a generalization of Boolean cir ...
. A device invokes a level-triggered interrupt by driving the signal to and holding it at the active level. It negates the signal when the processor commands it to do so, typically after the device has been serviced. The processor samples the interrupt input signal during each instruction cycle. The processor will recognize the interrupt request if the signal is asserted when sampling occurs. Level-triggered inputs allow multiple devices to share a common interrupt signal via wired-OR connections. The processor polls to determine which devices are requesting service. After servicing a device, the processor may again poll and, if necessary, service other devices before exiting the ISR.


Edge-triggered

An ''edge-triggered interrupt'' is an interrupt signaled by a level transition on the interrupt line, either a falling edge (high to low) or a rising edge (low to high). A device wishing to signal an interrupt drives a pulse onto the line and then releases the line to its inactive state. If the pulse is too short to be detected by
polled I/O Polling, or polled operation, in computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer ...
then special hardware may be required to detect it. The important part of edge triggering is that if (say) the interrupt was triggered by a high to low edge transition, that if the level remained low it would not trigger a further interrupt. It must return to the high level before falling again in order to trigger a further interrupt. This contrasts with a level trigger where the low level would continue to create interrupts (if they are enabled) until the signal returns to its high level. Computers with edge-triggered interrupts may include an ''interrupt register'' that retains the status of pending interrupts. Systems with interrupt registers generally have interrupt mask registers as well.


Processor response

The processor samples the interrupt trigger signals or interrupt register during each instruction cycle, and will process the highest priority enabled interrupt found. Regardless of the triggering method, the processor will begin interrupt processing at the next instruction boundary following a detected trigger, thus ensuring: * The processor status is saved in a known manner. Typically the status is stored in a known location, but on some systems it is stored on a stck. * All instructions before the one pointed to by the PC have fully executed. * No instruction beyond the one pointed to by the PC has been executed, or any such instructions are undone before handling the interrupt. * The execution state of the instruction pointed to by the PC is known.


System implementation

Interrupts may be implemented in hardware as a distinct component with control lines, or they may be integrated into the memory subsystem. If implemented in hardware as a distinct component, an interrupt controller circuit such as the IBM PC's
Programmable Interrupt Controller In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and soft ...
(PIC) may be connected between the interrupting device and the processor's interrupt pin to
multiplex Multiplex may refer to: * Multiplex (automobile), a former American car make * Multiplex (comics), a DC comic book supervillain * Multiplex communication or multiplexing, combining many signals into a single transmission circuit or channel ** Multi ...
several sources of interrupt onto the one or two CPU lines typically available. If implemented as part of the
memory controller The memory controller is a digital circuit that manages the flow of data going to and from the computer's main memory Computer data storage is a technology consisting of computer components and Data storage device, recording media that ar ...
, interrupts are mapped into the system's memory
address space In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and softwa ...
.


Shared IRQs

Multiple devices may share an edge-triggered interrupt line if they are designed to. The interrupt line must have a pull-down or pull-up resistor so that when not actively driven it settles to its inactive state, which is the default state of it. Devices signal an interrupt by briefly driving the line to its non-default state, and let the line float (do not actively drive it) when not signaling an interrupt. This type of connection is also referred to as
open collector An open collector is a common type of output found on many integrated circuits (IC), which behaves like a switch that is either connected to ground or disconnected. Instead of outputting a signal of a specific voltage or current, the output signa ...
. The line then carries all the pulses generated by all the devices. (This is analogous to the
pull cord A pullstring (pull string, pull-string), pullcord (pull cord, pull-cord), or pullchain (pull-chain, pull chain) is a string, cord, or chain Roller chains A chain is a serial assembly of connected pieces, called links, typically made of met ...
on some buses and trolleys that any passenger can pull to signal the driver that they are requesting a stop.) However, interrupt pulses from different devices may merge if they occur close in time. To avoid losing interrupts the CPU must trigger on the trailing edge of the pulse (e.g. the rising edge if the line is pulled up and driven low). After detecting an interrupt the CPU must check all the devices for service requirements. Edge-triggered interrupts do not suffer the problems that level-triggered interrupts have with sharing. Service of a low-priority device can be postponed arbitrarily, while interrupts from high-priority devices continue to be received and get serviced. If there is a device that the CPU does not know how to service, which may raise spurious interrupts, it won't interfere with interrupt signaling of other devices. However, it is easy for an edge-triggered interrupt to be missed - for example, when interrupts are masked for a period - and unless there is some type of hardware latch that records the event it is impossible to recover. This problem caused many "lockups" in early computer hardware because the processor did not know it was expected to do something. More modern hardware often has one or more interrupt status registers that latch interrupts requests; well-written edge-driven interrupt handling code can check these registers to ensure no events are missed. The elderly
Industry Standard Architecture Industry Standard Architecture (ISA) is the 16-bit 16-bit microcomputer A microcomputer is a small, relatively inexpensive computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical op ...
(ISA) bus uses edge-triggered interrupts, without mandating that devices be able to share IRQ lines, but all mainstream ISA motherboards include pull-up resistors on their IRQ lines, so well-behaved ISA devices sharing IRQ lines should just work fine. The
parallel port In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware ...
also uses edge-triggered interrupts. Many older devices assume that they have exclusive use of IRQ lines, making it electrically unsafe to share them. There are 3 ways multiple devices "sharing the same line" can be raised. First is by exclusive conduction (switching) or exclusive connection (to pins). Next is by bus (all connected to the same line listening): cards on a bus must know when they are to talk and not talk (i.e., the ISA bus). Talking can be triggered in two ways: by accumulation latch or by logic gates. Logic gates expect a continual data flow that is monitored for key signals. Accumulators only trigger when the remote side excites the gate beyond a threshold, thus no negotiated speed is required. Each has its speed versus distance advantages. A trigger, generally, is the method in which excitation is detected: rising edge, falling edge, threshold (
oscilloscope An oscilloscope, previously called an oscillograph, and informally known as a scope or o-scope, CRO (for cathode-ray oscilloscope), or DSO (for the more modern digital storage oscilloscope A digital storage oscilloscope (DSO) is an oscillosco ...

oscilloscope
can trigger a wide variety of shapes and conditions). Triggering for software interrupts must be built into the software (both in OS and app). A 'C' app has a trigger table (a table of functions) in its header, which both the app and OS know of and use appropriately that is not related to hardware. However do not confuse this with hardware interrupts which signal the CPU (the CPU enacts software from a table of functions, similarly to software interrupts).


Difficulty with sharing interrupt lines

Multiple devices sharing an interrupt line (of any triggering style) all act as spurious interrupt sources with respect to each other. With many devices on one line, the workload in servicing interrupts grows in proportion to the square of the number of devices. It is therefore preferred to spread devices evenly across the available interrupt lines. Shortage of interrupt lines is a problem in older system designs where the interrupt lines are distinct physical conductors. Message-signaled interrupts, where the interrupt line is virtual, are favored in new system architectures (such as
PCI Express PCI Express (Peripheral Component Interconnect Express), officially abbreviated as PCIe or PCI-e, is a high-speed serial Serial may refer to: Arts, entertainment, and media The presentation of works in sequential segments * Serial (literat ...

PCI Express
) and relieve this problem to a considerable extent. Some devices with a poorly designed programming interface provide no way to determine whether they have requested service. They may lock up or otherwise misbehave if serviced when they do not want it. Such devices cannot tolerate spurious interrupts, and so also cannot tolerate sharing an interrupt line. ISA cards, due to often cheap design and construction, are notorious for this problem. Such devices are becoming much rarer, as hardware logic becomes cheaper and new system architectures mandate shareable interrupts.


Hybrid

Some systems use a hybrid of level-triggered and edge-triggered signaling. The hardware not only looks for an edge, but it also verifies that the interrupt signal stays active for a certain period of time. A common use of a hybrid interrupt is for the NMI (non-maskable interrupt) input. Because NMIs generally signal major – or even catastrophic – system events, a good implementation of this signal tries to ensure that the interrupt is valid by verifying that it remains active for a period of time. This 2-step approach helps to eliminate false interrupts from affecting the system.


Message-signaled

A ''message-signaled interrupt'' does not use a physical interrupt line. Instead, a device signals its request for service by sending a short message over some communications medium, typically a
computer bus In computer architecture In computer engineering, computer architecture is a set of rules and methods that describe the functionality, organization, and implementation of computer A computer is a machine that can be programmed to carry ...
. The message might be of a type reserved for interrupts, or it might be of some pre-existing type such as a memory write. Message-signalled interrupts behave very much like edge-triggered interrupts, in that the interrupt is a momentary signal rather than a continuous condition. Interrupt-handling software treats the two in much the same manner. Typically, multiple pending message-signaled interrupts with the same message (the same virtual interrupt line) are allowed to merge, just as closely spaced edge-triggered interrupts can merge. Message-signalled
interrupt vector An interrupt vector table (IVT) is a data structure that associates a list of interrupt handlers with a list of interrupt requests in a table of interrupt vectors. Each entry of the interrupt vector table, called an interrupt vector, is the addres ...
s can be shared, to the extent that the underlying communication medium can be shared. No additional effort is required. Because the identity of the interrupt is indicated by a pattern of data bits, not requiring a separate physical conductor, many more distinct interrupts can be efficiently handled. This reduces the need for sharing. Interrupt messages can also be passed over a serial bus, not requiring any additional lines.
PCI Express PCI Express (Peripheral Component Interconnect Express), officially abbreviated as PCIe or PCI-e, is a high-speed serial Serial may refer to: Arts, entertainment, and media The presentation of works in sequential segments * Serial (literat ...

PCI Express
, a serial computer bus, uses message-signaled interrupts exclusively.


Doorbell

In a
push button A push-button (also spelled pushbutton) or simply button is a simple switch mechanism to control some aspect of a machine A machine is a man-made device that uses power to apply forces and control movement to perform an action. Machines ...
analogy applied to
computer systems A computer is a machine A machine is a man-made device that uses power to apply forces and control movement to perform an action. Machines can be driven by animals and people A people is a plurality of person A person (plural ...
, the term ''doorbell'' or ''doorbell interrupt'' is often used to describe a mechanism whereby a
software Software is a collection of Instruction (computer science), instructions that tell a computer how to work. This is in contrast to Computer hardware, hardware, from which the system is built and actually performs the work. At the low level lang ...

software
system can signal or notify a
computer hardware Computer hardware includes the physical parts of a computer, such as the computer case, case, central processing unit (CPU), Computer monitor, monitor, Computer mouse, mouse, Computer keyboard, keyboard, computer data storage, graphics card, so ...

computer hardware
device that there is some work to be done. Typically, the software system will place data in some well-known and mutually agreed upon memory locations, and "ring the doorbell" by writing to a different memory location. This different memory location is often called the doorbell region, and there may even be multiple doorbells serving different purposes in this region. It is this act of writing to the doorbell region of memory that "rings the bell" and notifies the hardware device that the data are ready and waiting. The hardware device would now know that the data are valid and can be acted upon. It would typically write the data to a
hard disk drive A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device On a reel-to-reel tape recorder (Sony TC-630), the recorder is data storage equipment and the magnetic tape is a data stora ...

hard disk drive
, or send them over a
network Network, networking and networked may refer to: Science and technology * Network theory, the study of graphs as a representation of relations between discrete objects * Network science, an academic field that studies complex networks Mathematics ...
, or
encrypt In cryptography Cryptography, or cryptology (from grc, , translit=kryptós "hidden, secret"; and ''graphein'', "to write", or ''-logia ''-logy'' is a suffix In linguistics Linguistics is the science, scientific study of la ...

encrypt
them, etc. The term ''doorbell interrupt'' is usually a
misnomer A misnomer is a name that is incorrectly or unsuitably applied. Misnomers often arise because something was named long before its correct nature was known, or because an earlier form of something has been replaced by a later form to which the na ...
. It is similar to an interrupt, because it causes some work to be done by the device; however, the doorbell region is sometimes implemented as a polled region, sometimes the doorbell region writes through to physical device registers, and sometimes the doorbell region is hardwired directly to physical device registers. When either writing through or directly to physical device registers, this may cause a real interrupt to occur at the device's central processor unit (
CPU A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuit File:PExdcr01CJC.jpg, 200px, A circuit built on a printed circuit board (PCB). An electronic circuit is composed of ...

CPU
), if it has one. Doorbell interrupts can be compared to
Message Signaled InterruptsMessage Signalled Interrupts (MSI) are an alternative in-band method of signalling an interrupt, using special in-band messages to replace traditional Out-of-band data, out-of-band assertion of dedicated interrupt lines. While more complex to implem ...
, as they have some similarities.


Multiprocessor IPI

In
multiprocessor Multiprocessing is the use of two or more central processing units A central processing unit (CPU), also called a central processor, main processor or just Processor (computing), processor, is the electronic circuitry that executes Instruct ...
systems, a processor may send an interrupt request to another processor via inter-processor interrupts'' (IPI).


Performance

Interrupts provide low overhead and good
latency Latency or latent may refer to: Science and technology * Latent heat, energy released or absorbed, by a body or a thermodynamic system, during a constant-temperature process * Latent variable, a variable that is not directly observed but inferred i ...
at low load, but degrade significantly at high interrupt rate unless care is taken to prevent several pathologies. The phenomenon where the overall system performance is severely hindered by excessive amounts of processing time spent handling interrupts is called an
interrupt storm In operating systems, an interrupt storm is an event during which a processor receives an inordinate number of interrupts that consume the majority of the processor's time. Interrupt storms are typically caused by hardware devices that do not suppor ...
. There are various forms of
livelock File:Deadlock at a four-way-stop.gif, thumbnail, Four processes (blue lines) compete for one resource (grey circle), following a right-before-left policy. A deadlock occurs when all processes lock the resource simultaneously (black lines). The ...
s, when the system spends all of its time processing interrupts to the exclusion of other required tasks. Under extreme conditions, a large number of interrupts (like very high network traffic) may completely stall the system. To avoid such problems, an
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
must schedule network interrupt handling as carefully as it schedules process execution. With multi-core processors, additional performance improvements in interrupt handling can be achieved through receive-side scaling (RSS) when
multiqueue NIC A network interface In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardwa ...
s are used. Such NICs provide multiple receive queues associated to separate interrupts; by routing each of those interrupts to different cores, processing of the interrupt requests triggered by the network traffic received by a single NIC can be distributed among multiple cores. Distribution of the interrupts among cores can be performed automatically by the operating system, or the routing of interrupts (usually referred to as ''IRQ affinity'') can be manually configured. A purely software-based implementation of the receiving traffic distribution, known as ''receive packet steering'' (RPS), distributes received traffic among cores later in the data path, as part of the
interrupt handler In computer systems programming, an interrupt handler, also known as an interrupt service routine or ISR, is a special block of code associated with a specific interrupt In digital computers, an interrupt is a response by the central processi ...
functionality. Advantages of RPS over RSS include no requirements for specific hardware, more advanced traffic distribution filters, and reduced rate of interrupts produced by a NIC. As a downside, RPS increases the rate of
inter-processor interrupt An inter-processor interrupt (IPI) is a special type of interrupt In digital computer A computer is a machine A machine is a man-made device that uses power to apply forces and control movement to perform an action. Machines can ...
s (IPIs). ''Receive flow steering'' (RFS) takes the software-based approach further by accounting for application locality; further performance improvements are achieved by processing interrupt requests by the same cores on which particular network packets will be consumed by the targeted application.


Typical uses

Interrupts are commonly used to service hardware timers, transfer data to and from storage (e.g., disk I/O) and communication interfaces (e.g.,
UART A universal asynchronous receiver-transmitter (UART ) is a computer hardware Computer hardware includes the physical parts of a computer, such as the computer case, case, central processing unit (CPU), Computer monitor, monitor, Computer mo ...

UART
,
Ethernet Ethernet () is a family of wired computer network A computer network is a set of s sharing resources located on or provided by . The computers use common s over to communicate with each other. These interconnections are made up of te ...

Ethernet
), handle keyboard and mouse events, and to respond to any other time-sensitive events as required by the application system. Non-maskable interrupts are typically used to respond to high-priority requests such as watchdog timer timeouts, power-down signals and traps. Hardware timers are often used to generate periodic interrupts. In some applications, such interrupts are counted by the interrupt handler to keep track of absolute or elapsed time, or used by the OS task scheduler to manage execution of running
processes A process is a series or set of Action (philosophy), activities that interact to produce a result; it may occur once-only or be recurrent or periodic. Things called a process include: Business and management *Business process, activities that pro ...
, or both. Periodic interrupts are also commonly used to invoke sampling from input devices such as
analog-to-digital converter In electronics, an analog-to-digital converter (ADC, A/D, or A-to-D) is a system that converts an analog signal, such as a sound picked up by a microphone or light entering a digital camera, into a Digital signal (signal processing), digit ...
s, incremental encoder interfaces, and
GPIO A general-purpose input/output (GPIO) is an uncommitted digital signal Pin (electronics), pin on an integrated circuit or electronic circuit board which may be used as an input or output, or both, and is controllable by the user at Runtime (progr ...
inputs, and to program output devices such as
digital-to-analog converter In electronics The field of electronics is a branch of physics and electrical engineering that deals with the emission, behaviour and effects of electrons The electron is a subatomic particle In physical sciences, subatomic ...
s,
motor controllerA motor controller is a device or group of devices that can coordinate in a predetermined manner the performance of an electric motor. A motor controller might include a manual or automatic means for starting and stopping the motor, selecting forwar ...
s, and GPIO outputs. A disk interrupt signals the completion of a data transfer from or to the disk peripheral; this may cause a process to run which is waiting to read or write. A power-off interrupt predicts imminent loss of power, allowing the computer to perform an orderly shut-down while there still remains enough power to do so. Keyboard interrupts typically cause keystrokes to be buffered so as to implement typeahead. Interrupts are sometimes used to emulate instructions which are unimplemented on some computers in a product family. For example
floating point In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and soft ...
instructions may be implemented in hardware on some systems and emulated on lower-cost systems. In the latter case, execution of an unimplemented floating point instruction will cause an "illegal instruction" exception interrupt. The interrupt handler will implement the floating point function in software and then return to the interrupted program as if the hardware-implemented instruction had been executed. This provides application software portability across the entire line. Interrupts are similar to signals, the difference being that signals are used for
inter-process communication In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , ...
(IPC), mediated by the kernel (possibly via system calls) and handled by processes, while interrupts are mediated by the processor and handled by the
kernel Kernel may refer to: Computing * Kernel (operating system), the central component of most operating systems * Kernel (image processing), a matrix used for image convolution * Compute kernel, in GPGPU programming * Kernel method, in machine learnin ...
. The kernel may pass an interrupt as a signal to the process that caused it (typical examples are
SIGSEGV In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and softwa ...
, SIGBUS,
SIGILL Signals are standardized messages sent to a running program to trigger specific behavior, such as quitting or error handling. They are a limited form of inter-process communication In computer science Computer science deals with the t ...
and
SIGFPE Signals are standardized messages sent to a running program to trigger specific behavior, such as quitting or error handling. They are a limited form of inter-process communication In computer science Computer science deals with the ...
).


History

Hardware interrupts were introduced as an optimization, eliminating unproductive waiting time in polling loops, waiting for external events. The first system to use this approach was the
DYSEAC DYSEAC was the second Standards Electronic Automatic Computer. (See SEAC.) DYSEAC was a first-generation computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Mod ...
, completed in 1954, although earlier systems provided error trap functions. The
UNIVAC 1103A The UNIVAC 1103 or ERA 1103, a successor to the UNIVAC 1101 The ERA 1101, later renamed UNIVAC 1101, was a computer system designed and built by Engineering Research Associates (ERA) in the early 1950s and continued to be sold by the Remington Ra ...
computer is generally credited with the earliest use of interrupts in 1953. Earlier, on the
UNIVAC I The UNIVAC I (UNIVersal Automatic Computer I) was the first general-purpose electronic digital computer design for business application produced in the United States The United States of America (U.S.A. or USA), commonly known as the Uni ...
(1951) "Arithmetic overflow either triggered the execution of a two-instruction fix-up routine at address 0, or, at the programmer's option, caused the computer to stop." The
IBM 650 The IBM 650 Magnetic Drum Data-Processing Machine is an early digital computer A computer is a machine A machine is a man-made device that uses power to apply forces and control movement to perform an action. Machines can be dri ...
(1954) incorporated the first occurrence of interrupt masking. The
National Bureau of Standards The National Institute of Standards and Technology (NIST) is a physical sciences Physical science is a branch of natural science that studies abiotic component, non-living systems, in contrast to life science. It in turn has many branches, e ...
DYSEAC DYSEAC was the second Standards Electronic Automatic Computer. (See SEAC.) DYSEAC was a first-generation computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Mod ...
(1954) was the first to use interrupts for I/O. The
IBM 704 The IBM 704, introduced by IBM International Business Machines Corporation (IBM) is an American multinational technology company headquartered in Armonk, New York, with operations in over 170 countries. The company began in 1911, founde ...
was the first to use interrupts for
debugging In computer programming Computer programming is the process of designing and building an executable In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, caus ...

debugging
, with a "transfer trap", which could invoke a special routine when a branch instruction was encountered. The MIT
Lincoln Laboratory The MIT Lincoln Laboratory, located in Lexington, Massachusetts Lexington is a suburban town in Middlesex County, Massachusetts, United States. It is 10 miles (16 km) from Downtown Boston. The population was 34,454 as of the 2020 census. ...
TX-2 The MIT Massachusetts Institute of Technology (MIT) is a private land-grant research university A research university is a university A university ( la, universitas, 'a whole') is an educational institution, institution of higher e ...
system (1957) was the first to provide multiple levels of priority interrupts.


See also

*
Advanced Programmable Interrupt Controller In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and softwar ...
(APIC) *
BIOS interrupt call BIOS interrupt In s, an interrupt is a response by the to an event that needs attention from the software. An interrupt condition alerts the processor and serves as a request for the processor to interrupt the currently executing code when pe ...
*
Event-driven programming In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, gene ...
*
Exception handling In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithm of an algorithm (Euclid's algorithm) for calculating the greatest commo ...
*
INT (x86 instruction) INT is an assembly language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves ta ...
* Interrupt coalescing *
Interrupt handler In computer systems programming, an interrupt handler, also known as an interrupt service routine or ISR, is a special block of code associated with a specific interrupt In digital computers, an interrupt is a response by the central processi ...
*
Interrupt latency In computing, interrupt latency is the time that elapses from when an interrupt In digital computer A computer is a machine A machine is a man-made device that uses power to apply forces and control movement to perform an action ...
*
Interrupts in 65xx processors The 65xx family of microprocessor A microprocessor is a computer processor where the data processing logic and control is included on a single integrated circuit, or a small number of integrated circuits. The microprocessor is a multipurpose ...
*
Ralf Brown's Interrupt List Ralf Brown's Interrupt List (aka RBIL, x86 Interrupt List, MS-DOS Interrupt List or INTER) is a comprehensive list of interrupt In s, an interrupt is a response by the to an event that needs attention from the software. An interrupt conditio ...
* Interrupts on IBM System/360 architecture *
Time-triggered systemTime-triggered architecture (abbreviated as TTA), also known as a time-triggered system, is a computer system that executes one or more sets of tasks according to a pre-determined and set task schedule.Pont, M.J. (2001) "Patterns for Time-Triggered E ...
*
Autonomous peripheral operation In computing, autonomous peripheral operation is a hardware feature found in some modern microcontroller A microcontroller (MCU for ''microcontroller unit'') is a small computer on a single metal-oxide-semiconductor (MOS) integrated circuit (IC) ...


Notes


References


External links


Interrupts Made EasyInterrupts for Microchip PIC Microcontroller
archived from the original on March 13, 2012 {{Authority control