Penguin
Annotated edit history of IRQ version 6, including all changes. View license author blame.
Rev Author # Line
3 JohnMcPherson 1 An [Acronym] for __I__nterrupt __R__e__Q__uest.
2
5 JohnMcPherson 3 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 small piece of code
4 (called an InterruptHandler) to do something based on this. (This is sometimes
5 also called a trap).
3 JohnMcPherson 6
7 That sounds very vague, so maybe some examples.
8
4 JohnMcPherson 9 * 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 its write function.
3 JohnMcPherson 10
4 JohnMcPherson 11 * 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 its requests get serviced first as the OS uses the timer to keep track of the time!
3 JohnMcPherson 12
13 * 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.
14
15 On linux, type:
16 watch --interval 1 cat /proc/interrupts
6 JohnMcPherson 17 or:
18 procinfo -n 1
3 JohnMcPherson 19 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!