Learn about the technologies behind the Internet with The TCP/IP Guide!
NOTE: Using robot software to mass-download the site degrades the server and is prohibited. See here for more.
Find The PC Guide helpful? Please consider a donation to The PC Guide Tip Jar. Visa/MC/Paypal accepted.
View over 750 of my fine art photos any time for free at DesktopScenes.com!

[ The PC Guide | Systems and Components Reference Guide | Motherboard and System Devices | System Resources | Interrupts (IRQs) | Interrupt Function and Operation ]

Why Interrupts Are Used to Process Information

The processor is a highly-tuned machine that is designed to (basically) do one thing at a time. However, we use our computers in a way that requires the processor to at least appear to do many things at once. If you've ever used a multitasking operating system like Windows 95, you've done this; you may have been editing a document while downloading information on your modem and listening to a CD simultaneously. The processor is able to do this by sharing its time among the various programs it is running and the different devices that need its attention. It only appears that the processor is doing many things at once because of the blindingly high speed that it is able to switch between tasks.

Most of the different parts of the PC need to send information to and from the processor, and they expect to be able to get the processor's attention when they need to do this. The processor has to balance the information transfers it gets from various parts of the machine and make sure they are handled in an organized fashion. There are two basic ways that the processor could do this:

  • Polling: The processor could take turns going to each device and asking if they have anything they need it to do. This is called polling the devices. In some situations in the computer world this technique is used, however it is not used by the processor in a PC for a couple of basic reasons. One reason is that it is wasteful; going around to all the devices constantly asking if they need the attention of the CPU wastes cycles that the processor could be doing something useful. This is particularly true because in most cases the answer will be "no". Another reason is that different devices need the processor's attention at differing rates; the mouse needs attention far less frequently than say, the hard disk (when it is actively transferring data).
  • Interrupting: The other way that the processor can handle information transfers is to let the devices request them when they need its attention. This is the basis for the use of interrupts. When a device has data to transfer, it generates an interrupt that says "I need your attention now, please". The processor then stops what it is doing and deals with the device that requested its attention. It actually can handle many such requests at a time, using a priority level for each to decide which to handle first.

It may seem like an inefficient way to run a computer, having it be interrupted all the time. I'm sure it must remind you of a day at the office, where the phone kept ringing every 5 minutes and you couldn't get anything done. However, without the ringer on the phone, the alternative would be to keep picking up the phone every 30 seconds to see if someone was trying to call you, which even the most ardent telephone-hater would have to admit is much worse. :^)

It's also interesting to put into perspective just how fast the modern processor is compared to many of the devices that transfer information to it. Let's imagine a very fast typist; say, 120 words per minute. At an average of 5 letters per word, this is 600 characters per minute on the keyboard. You might be fascinated to realize that if you type at this rate, a 200 MHz computer will process 20,000,000 instructions between each keystroke you make! You can see why having the processor spend a lot of time asking the keyboard if it needs anything would be wasteful, especially since at any time you might stop for a minute or two to review your writing, or do something else. Even while handling a full-bandwidth transfer from a 28,800 Kb/sec modem, which of course moves data much faster than your fingers, the processor has over 60,000 instruction cycles between bytes it needs to process.

In addition to the well-known hardware interrupts that we discuss in this section, there are also software interrupts. These are used by various software programs in response to different events that occur as the operating system and applications run. In essence, these represent the processor interrupting itself! This is part of how the processor is able to do many things at once. The other thing that software interrupts do is allow one program to access another one (usually an application or DOS accessing to the BIOS) without having to know where it resides in memory.

Next: Interrupt Controllers

Home  -  Search  -  Topics  -  Up

The PC Guide (http://www.PCGuide.com)
Site Version: 2.2.0 - Version Date: April 17, 2001
Copyright 1997-2004 Charles M. Kozierok. All Rights Reserved.

Not responsible for any loss resulting from the use of this site.
Please read the Site Guide before using this material.
Custom Search