Encyclopedia > Interrupt

  Article Content

Interrupt

Digital computers usually provide a way to start software routines in response to asynchronous electronic events. These events are signalled to the processor via interrupt requests (IRQ). The processor and interrupt code make a context switch into a specifically written piece of software to handle the interrupt. This software is called the interrupt routine.

Interrupts were originated to avoid wasting the computer's valuable time in software loops waiting for electronic events. Instead, the computer was to do other, useful work. The interrupt would signal the computer to complete the work that had been waiting for some slow mechanical device. Computers are now so cheap that this argument makes less sense.

Interrupts remain in modern computers because they permit a computer to have prompt responses to electronic events, while performing other work.

The waiting still occurs. Normally, the computer's microcode continually tests for an interrupt.

A well-designed interrupt mechanism arranges the design of the computer bus, software and interrupting device so that if some single part of the interrupt sequence fails, the interrupt restarts and runs to completion. Usually there is an electronic request, an electronic response, and a software operation to turn off the device's interrupt, to prevent another request.

Typical interrupt types include:

  • timer interrupts
  • disk interrupts
  • power-off interrupts

Other interrupts exist to transfer data bytes using UARTs, or Ethernet, sense key-presses, control motors, or anything else the equipment must do.

A classic timer interrupt just interrupts periodically from a counter or the power-line. The software (usually part of an operating system) counts the interrupts to keep time. The timer interrupt may also be used to reschedule the priorities of running processes. Counters are popular, but some older computers used the power line because power companies control the power-line frequency with an atomic clock.

A disk interrupt signals the completion of a data transfer from or to the disk peripheral. A process waiting to read or write a file starts up again.

A power-off interrupt predicts or requests a loss of power. It allows the computer equipment to perform an orderly shutdown.

Interrupt routines generally have a short execution time. Most interrupt routines do not allow themselves to be interrupted, because they store saved context on a stack, and if interrupted many times, the stack could overflow. An interrupt routine frequently needs to be able to respond to a further interrupt from the same source.

Processors also often have a mechanism referred to as interrupt disable which allows a software to prevent interrupts from interfering with communication between interrupt-code and non-interrupt code. See mutual exclusion.



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Photosynthesis

... contain various other pigments. It may be noted that the typical colors of photosynthetic organisms (green, brown, golden, or red) result from the light that is not ...

 
 
 
This page was created in 35.3 ms