Minor evaluation interruptions, traps, and exceptions
Hedgehog @ http://blog.csdn.net/littlehedgehog
A good article I read a few days ago introduces interrupt, traps, and exception from another perspective ).
External interruption is what we call interrupt ). For the execution system, this interruption occurs completely"Asynchronous", There is no way to predict when such interruptions will occur. Therefore, the CPU (or software) for such external interruptions is completely"Passive. However, the software can close the response to the interruption in the form of Guanzhong disconnection, and cut off the way it "reflects the situation.
Software-generated interruptions are different. They are specialized commands, such as Intel x86 "int N ",InProgramIntentionally generated, so it is active, "Synchronous. As long as the CPU executes an int command, it knows that the service interruption program must be started before the next command is executed. This kind of active interruption is called a "trap ".
In addition, there is also a mechanism similar to the interrupt called "exception" (exception), which is generallyAsynchronousMost of the reasons are due to "carelessness. For example, when you issue a division command DIV in a program, an exception occurs when the divisor is zero. This is mostly due to carelessness rather than intention, so it is also passive. Of course, we can divide it by zero on purpose.
The most common difference between interruptions and exceptions is"Unpredictability", So it is forced, and there are traps"Intentionally. In fact, this kind of thing can be understood, just prepare an Intel manual when doing system programming.