INTERRUPT HANDLER
\ˈɪntəɹˌʌpt hˈandlə], \ˈɪntəɹˌʌpt hˈandlə], \ˈɪ_n_t_ə_ɹ_ˌʌ_p_t h_ˈa_n_d_l_ə]\
Sort: Oldest first
-
A routine which is executed when an interruptoccurs. Interrupt handlers typically deal with low-levelevents in the hardware of a computer system such as acharacter arriving at a serial port or a tick of areal-time clock. Special care is required when writing aninterrupt handler to ensure that either the interrupt whichtriggered the handler's execution is masked out (inhibitted)until the handler exits, or the handler is re-entrant sothat multiple concurrent invocations will not interfere witheach other.If interrupts are masked then the handler must execute asquickly as possible so that important events are not missed.This is often arranged by splitting the processing associatedwith the event into "upper" and "lower" halves. The lowerpart is the interrupt handler which masks out furtherinterrupts as required, checks that the appropriate event hasoccurred (this may be necessary if several events share thesame interrupt), services the interrupt, e.g. by reading acharacter from a UART and writing it to a queue, andre-enabling interrupts.The upper half executes as part of a user process. It waitsuntil the interrupt handler has run. Normally the operatingsystem is responsible for reactivating a process which iswaiting for some low-level event. It detects this by a sharedflag or by inspecting a shared queue or by some othersynchronisation mechanism. It is important that the upper andlower halves do not interfere if an interrupt occurs duringthe execution of upper half code. This is usually ensured bydisabling interrupts during critical sections of code suchas removing a character from a queue.
By Denis Howe