Penguin
Note: You are viewing an old revision of this page. View the current version.

An Acronym for Interrupt ReQuest.

In a typical computer, when a piece of hardware has finished doing a task, it raises an interrupt and the operating system runs a special handler to do something based on this. (This is sometimes also called a trap).

That sounds very vague, so maybe some examples.

  • A user program writes some data to a file, and the operating system probably caches it in a buffer. Eventually this buffer gets written to disk. The operating system is responsible for sending the data to disk, and when the disk has finished writing, it signals to the OS that it has finished via an interrupt, at which point the kernel can return from it's write function.
  • Almost all computers have a piece of hardware called a timer that has the sole purpose of generating interrupts at fixed intervals. This often has the highest priority so that it's requests get serviced first as the OS uses the timer to keep track of the time!
  • Continuously checking (called "polling") to see if the user has pressed a key is very inefficient, so, you get the keyboard controller to trigger an IRQ when the user presses a key, notifying the OS that a key has been pressed and it should wander off and do something about it.
On linux, type
watch --interval 1 cat /proc/interrupts

to see a running count of the number of interrupts your machine has made. (This works best if you run it on your own machine, and not remotely DanielLawson!). Move the mouse, play some sounds, access the hard drive, use the network and see the effect on the counts!