China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 07:55
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Understanding and Mastering “IRQ (Interrupt Request)” View 2,794 Replies 0
Original Poster Posted 2002-11-18 00:00 ·  中国 湖北 随州 电信
元老会员
★★★
Credits 1,987
Posts 632
Joined 2002-10-27 00:00
23-year member
UID 73
Gender Male
Status Offline
For most DIY experts, a computer’s IRQ settings are something “easily handled.” But for some “newbie” friends who are just getting into this area, becoming familiar with and mastering them still requires a process of understanding → familiarity → mastery. This article is intended to help you understand IRQ and skillfully master it.



  What Is IRQ


  IRQ stands for Interrupt Request, meaning “interrupt request” (below we will use IRQ). The role of IRQ is to carry out hardware interrupt requests in the computers we use, stopping the working state of the related hardware.

  We can use an everyday example to explain this. Suppose you are writing an e-mail to a friend, and suddenly the phone rings. Then you need to put down your pen and answer the phone, and after finishing the call, continue writing the letter. This example shows the process of an interrupt and its handling: the ringing phone temporarily interrupts your current work so that you deal with something more urgent—the phone call. After the call is finished, you return to your original work. In this example, the ringing phone can be called the “interrupt request,” your action of stopping the letter and answering the phone is the “interrupt response,” and the process of taking the call is the “interrupt handling.”

  When using a computer, every time we press a key on the keyboard, a keyboard interrupt signal is generated. The CPU has to stop the work it is currently processing in order to handle this signal, record which key was just pressed, and if the key corresponds to some operation, that operation must be given priority. Only then does it return to the work from before the keypress. If at this time the keyboard conflicts with the interrupt of some other hardware device (that is, the keyboard and another hardware device share one interrupt—similar to having two telephones in the house placed together, but with exactly the same ring tone, so when the phone rings you inevitably do not know which one to answer), then the computer cannot tell whether the signal that just arrived came from the keyboard or from the other hardware device, and this may lead to some problems. This shows the importance of “IRQ” in computer use. Therefore, assigning interrupts reasonably so that they do not conflict with one another is one of the key issues in ensuring the stable operation of a computer.


  Understanding IRQ


  Interrupts in a computer can be divided by the source of the signal into hardware interrupts and software interrupts. Hardware interrupts are mostly sent out by peripheral devices and the computer system controller, while software interrupts are generally generated by software commands. Hardware interrupts are further divided into “maskable interrupts” and “non-maskable interrupts.” As the names suggest, maskable interrupts can be either accepted and processed or delayed (that is, masked) by the computer according to the needs of the system; non-maskable interrupts directly activate the corresponding interrupt handler, and they cannot and will not be delayed. The IRQ interrupts we usually talk about are maskable hardware interrupts.

IRQ allocation table
Interrupt 0
System timer

Interrupt 1
Keyboard

Interrupt 2
Programmable interrupt controller

Interrupt 3
com2

Interrupt 4
com1

Interrupt 6
Floppy disk controller

Interrupt 7
Parallel port 1

Interrupt 8
System cmos/clock

Interrupt 12
ps/2 mouse

Interrupt 13
Math coprocessor

Interrupt 14
First ide controller

Interrupt 15
Second ide controller



  In earlier computer systems, the IRQs of various hardware devices were controlled by an interrupt controller chip such as the 8259 or 8259A (nowadays this chip is mostly integrated into other chips). At present there are 16 groups of IRQs. After excluding one IRQ group used for bridging, there are actually only 15 groups of IRQs available for hardware use. And these IRQs all have their own recommended assignments (see the IRQ allocation table).

  From the table above we can see that only four interrupts—5, 9, 10, and 11—are not occupied, and can be used by users for newly added hardware devices. Among them, the graphics card must exclusively occupy one interrupt, while the sound card generally also occupies two interrupts, used respectively for the MIDI interface and WAVE playback.

  Current Windows operating systems already use PNP technology. This “plug and play” feature can automatically assign IRQs, greatly simplifying user operation. However, this PNP technology also has its weakness: if the operating system cannot correctly recognize a newly installed device, then IRQs may conflict with other hardware devices during automatic assignment. In this case, simply manually reassign the IRQ settings of the old and new hardware so they no longer clash, and the problem can be solved.
http://dos.e-stone.cn/dosbbs
uploadImages/200311161145850422.swf
Forum Jump: