There are 2 ways of getting information to the computer, Polling and interrupts.
Polling
The first way is called polling. This involves the device to check all of it's connections to see if
there is data waiting. This is very inefficient because processing time is wasted while the CPU has to poll the different devices.
This is also a waste because there may not even be any data waiting for the CPU. If polling isn't performed often enough,
then urgent data could be waiting until the
connection is polled. On the other had, if there is no data, then polling too often will cause a major performance hit.
Polling is a very simple way of getting information, and for this reason it is used on
low bandwidth and low urgency devices such as mice and keyboards. This polling isn't done by the CPU, mind you,
it is performed by a dedicated I/O Controller, which in turn has an IRQ to the CPU.
Interrupts
Interrupt Requests (IRQ's) are more efficient than polling because they interrupt the processor
only when they need CPU attention. Each device is attached to an Interrupt Request Line.
The device sends a signal to the processor through the IRQ line, and the CPU only has poll the device
when there is a request in its IRQ buffer. This is very quick and efficient. When the processor has
time, it contacts that device which made the interrupt and requests the data.
The first computers had only 8 interrupts, number 0 to 7. This proved to be too few, but in order to
maintain compatible, a second interrupt controller was "cascaded" from the first using the 2nd
IRQ. The 2nd interrupt was then remapped to the 9th IRQ. This almost doubled the amount
of IRQ's availble to the system. This proved to be enough, for a while.
Before plug-and-play, device IRQ's had to be set up manually. IRQ's are assigned during
boot time, establishing links to the devices. IRQ's can be changed manually in the
BIOS, or the BIOS can assign them if the devices are plug and play. To prevent the
end user from having to rearrange IRQ's every time a device was added, manufacturers started to use a
set pattern for which devices used which IRQ's.
As you can see, there aren't many free interrupts, and most devices need their own. To solve the
problem of limited IRQ's, IRQ Sharing was developed and released int Windows95 Service
Release 2. This is where two devices can share the same IRQ. Only certain devices can do this, because
if both devices need the IRQ at the same time, problems can arise.
| IRQ | Commonly Used For |
| 0 | System Timer |
| 1 | Keyboard |
| 2 | 2nd IRQ Controller |
| 3 | Serial Port (COM2) |
| 4 | Serial Port (COM1) |
| 5 | 2nd Parallel-Port (LPT2) or NIC |
| 6 | Floppy Disk |
| 7 | Parallel Port (LPT) |
| 8 | Real Time Clock |
| 9 | (free) |
| 10 | Soundcard or NIC |
| 11 | (free) |
| 12 | PS-2 Mouse |
| 13 | FPU Math Co-Processor |
| 14 | Primary IDE Controller |
| 15 | Primary IDE Controller |
IRQ Steering
IRQ Steering only works with PCI bus devices. IRQ Steering is a more advanced plug-and-play,
and is also used to remap IRQs during run time for IRQ sharing. It will not work with ISA devices because
they all require their own dedicated IRQ. IRQ Steering, which is also referred to as PCI bus IRQ steering,
works by having operating system assign IRQ's instead of the BIOS. Windows displays a
"IRQ Holder for PCI Steering" in the "System Device" listing if IRQ Steering is being
used on a device. For IRQ sharing, the OS monitors the IRQs and devices, and remaps the IRQ
to the device which needs to use it.