What happens when the CPU (Central Processor Unit) is busy doing something, maybe defragmenting the hard disk or checking for viruses, and you press a key on the keyboard? You don't want to wait until the CPU is done with what it's doing before it recognizes your key press. You need some way to interrupt the CPU and say "hey, I need your attention here!". There are two ways to tell the CPU that you need it to interrupt what it's doing and work on something with a higher priority; polling and interrupts.
With polling, the CPU continuously runs a loop that checks each hardware device to see if it needs attention. If a device needs attention, the CPU suspends what it's working on and loads and runs the software required to service the hardware device. When the operation required by the device is finished, the CPU goes back to polling and working on what it's working on before it serviced the hardware device. Most modern hardware devices use interrupts.
An interrupt request (IRQ) is a connection between a hardware device and the CPU. A hardware device uses it's assigned IRQ line to signal or "interrupt" the CPU when it needs attention. Interrupts have priorities. For example, lets assume the CPU is running a virus checker and you decide to "drag and drop" a file. The file operation will raise an interrupt that will cause the CPU to suspend virus checking to perform the file moving operation. But while the file is being moved, you press a key on the keyboard.
Since the keyboard interrupt has a higher priority than the file moving operation, it will cause the CPU to suspend the file moving operation and load and run the software required to service the key press. When the operation required by the key press is finished, the CPU goes back to the file moving operation. After the file has been moved, provided you don't go and press another key, the CPU will return to running the virus checker. I think you can see how IRQ's work.
Early PC motherboards used the Intel 8259 Interrupt Controller IC. It provides 8 IRQ lines numbered IRQ0 - IRQ7. When a device such as the keyboard, disk drive, printer, and so on, needs to get the CPU's for attention, it activates it's assigned IRQ line. The Interrupt Controller then activates the INT signal to the CPU.
The CPU acknowledges the interrupt by lowering the INTA signal. Then the Interrupt Controller places the IRQ number on the data bus. The CPU uses the IRQ number to jump to the devices service routine in memory, and begins executing that code.
Later a second IRQ IC was added to provide channels 8 through 15. 8259 ICs can be cascaded by connecting IRQ2 of the master 8259 to the IRQ line of the slave. The CAS lines of all cascaded ICs form a private bus over which the cascaded 8259 IC's can communicate.
Hardware devices are traditionally assigned IRQ lines as shown in the table below:
Although these are the traditional IRQ assignments, most systems will have different assignments. This is because IRQ assignments can be changed manually, and several devices listed in the table have become obsolete, for example the Floppy Drive and the Parallel Port.
• In today's computers the IRQ circuits are integrated into the chipset. The development of the Advanced Configuration and Power Interface (ACPI) allows for IRQ numbers above 15. These are actually virtual interrupts mapped to a single real interrupt, usually IRQ 9 or 11.
More Computer Architecture Articles:
• Operating System Memory Allocation Methods
• Operating System Boot
• Integrated Circuit Design Flow
• Multi-Processor Scheduling
• Digital Logic Semiconductor Families
• The Use of SOI (Silicone on Insulator) Wafers in MEMS (Micro-Electro-Mechanical Systems) Production
• Shortest-Job-First CPU Scheduling Algorithm
• Virtual Memory and Memory Paging
• The Fetch, Decode, Execute Cycle
• Binary Number Representation and Binary Math