trap, exception, fault, interrupt, abort
Computers screw up. You can have meaningless instructions,
attempts to divide by zero, attempts to access non-existent memory,
and other situations the cpu can't deal with. These are all similar
events, and some are used interchangeably at times. There are
subtle differences in what these specifically mean, but there is
also a lot of overlap.
First, consider the mechanics: if we have a problem (like
division by zero or a bad memory reference), we need both code to
handle the problem and a way to get to that code. Handling might
mean printing an informative warning message, silently allocating
memory for a process that needs it,killing off an errant process,
or even shutting down the entire machine. The way to get to the
handler is going to be through some sort of vector table: if you
have problem number 0, jump to this code, and so on.
So all these things are really interrupts to normal CPU
instruction flow. If we want to be precise, we can say that
"interrupts" come from outside the cpu's hardware (some other
device requesting attention or program code requesting a software
interrupt), a "fault" happens before the CPU can execute the
instruction (divide by zero, bogus instruction), a trap happens
after or during the execution (a debugger breakpoint, an overflow
situation), and an "abort" is something where the CU has no idea
what is going on at all.
Got something to add? Send me email.
Increase ad revenue 50-250% with Ezoic
More Articles by Tony Lawrence
Find me on Google+
© 2011-07-05 Tony Lawrence