Interrupt handler

Interrupt handler

An interrupt handler, also known as an interrupt service routine (ISR), is a callback subroutine in an operating system or device driver whose execution is triggered by the reception of an interrupt. Interrupt handlers have a multitude of functions, which vary based on the reason the interrupt was generated and the speed at which the Interrupt Handler completes its task.

An interrupt handler is a low-level counterpart of event handlers. These handlers are initiated by either hardware interrupts or interrupt instructions in software, and are used for servicing hardware devices and transitions between protected modes of operation such as system calls.

Overview

In modern operating systems, interrupt handlers are divided into two parts: the First-Level Interrupt Handler (FLIH) and the Second-Level Interrupt Handlers (SLIH). FLIHs are also known as "hard interrupt handlers", "fast interrupt handlers" and "top-half of interrupt", and SLIHs are also known as "interrupt threads", "slow interrupt handlers" and "bottom-half of interrupt".

A FLIH implements at minimum platform specific interrupt handling similarly to "interrupt routines". In response to an interrupt, there is a context switch, and the code for the interrupt is loaded and executed. The job of a FLIH is to quickly service the interrupt, or to record platform specific critical information which is only available at the time of the interrupt, and schedule the execution of a SLIH for further long-lived interrupt handling.

FLIHs cause jitter in process execution. FLIHs also mask interrupts. Reducing the jitter is most important for real-time operating systems, since they must maintain a guarantee that execution of specific code will complete within an agreed amount of time.To reduce jitter and to reduce the potential for losing data from masked interrupts, programmers attempt to minimize the execution time of a FLIH, moving as much as possible to the SLIH.With the speed of modern computers, FLIHs may implement all device and platform dependent handling, and use a SLIH for further platform independent long-lived handling.

FLIHs which service hardware typically mask their associated interrupt (or keep it masked as the case may be) until they complete their execution. Otherwise, these interrupt handlers might cause a stack overflow from multiple preemptions by the same interrupt vector. In a priority interrupt system, the FLIH also (briefly) masks other interrupts of equal or lesser priority.

A SLIH completes long interrupt processing tasks similarly to a process. SLIHs either have a dedicated kernel thread for each handler, or are executed by a pool of kernel worker threads. These threads sit on a run queue in the operating system until processor time is available for them to perform processing for the interrupt. SLIHs may have a long-lived execution time, and thus are typically scheduled similarly to threads and processes.

It is worth noting that in many systems the FLIH and SLIH are referred to as "upper halves" and "lower halves", "hardware" and "software" interrupts, or a derivation of those names.

Interrupt threads

Several operating systems - Solaris, Mac OS X, WinCE and FreeBSD, for example - use different scheme known as interrupt threads: interrupt handler is just a high-priority thread which runs with interrupts enabled and, more importantly, may block on mutex. This greatly simplifies locking in the kernel. Also, interrupt thread may be preempted by higher-priority interrupt thread.

SymbianOS

Because (amongst other reasons) extended processing in a ISR delays the servicing of other interrupts, Symbian OS uses Delayed Function Calls (DFCs) to perform processing that would be impossible inside the ISR [http://developer.symbian.com/main/downloads/papers/HWinterupt/HwInterrupt.pdf] .

See also

* Advanced Programmable Interrupt Controller
* Inter-Processor Interrupt
* Interrupt
* Interrupt Latency
* Non-Maskable Interrupt
* Programmable Interrupt Controller


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Interrupt Handler — Interrupt Handler,   ein kleines Dienstprogramm des Betriebssystems (ein so genannter Handler), das beim Auftreten eines Interrupts ausgeführt wird. Jeder Art von Interrupt ist ein spezielles Programm zugeordnet, das auf die Unterbrechungsursache …   Universal-Lexikon

  • interrupt handler —    Special software located in the operating system kernel that manages and processes system interrupts.    Also known as an interrupt service routine (ISR).    When an interrupt occurs, the processor suspends and saves its current activity and… …   Dictionary of networking

  • interrupt handler — pertraukties procedūra statusas T sritis informatika apibrėžtis Procedūra, apdorojanti ↑pertrauktį. Iškviečiama įvykus pertraukčiai. Gali apdoroti vieną arba kelias giminingas pertrauktis. atitikmenys: angl. interrupt handler; interrupt procedure …   Enciklopedinis kompiuterijos žodynas

  • interrupt handler — pertraukčių tvarkyklė statusas T sritis radioelektronika atitikmenys: angl. interrupt handler vok. Inrerruptbehandungsprogramm, n rus. обработчик прерываний, m pranc. gestionnaire d interruptions, m …   Radioelektronikos terminų žodynas

  • Handler — may refer to:a person who handles something: ** animal handler, person who conducts animal training or is a wrangler (profession). ** a sports handler, a coach (sport) or sports agent of a sports player, or a promoter (entertainment) ** agent… …   Wikipedia

  • Interrupt —   [dt. »Unterbrechung«] der, eine Unterbrechung des aktuellen Prozesses, die ein Prozessor in regelmäßigen Abständen oder bei Vorliegen einer entsprechenden Anfrage vornimmt, um Systemroutinen bzw. die Anforderung abzuarbeiten. Der Prozessor… …   Universal-Lexikon

  • Interrupt — This article is about computer interrupts. For the study of the effect of disruptions on job performance, see Interruption science. In computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in… …   Wikipedia

  • 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… …   Wikipedia

  • Interrupt latency — In Realtime Operating Systems, Interrupt latency is the time between the generation of an interrupt by a device and the servicing of the device which generated the interrupt. For many operating systems, devices are serviced as soon as the device… …   Wikipedia

  • Interrupt vector — An interrupt vector is the memory address of an interrupt handler, or an index into an array called an interrupt vector table or dispatch table . Interrupt vector tables contain the memory addresses of interrupt handlers. When an interrupt is… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”