Difference between software interrupt, exception, trap

Difference between software interrupt, exception, trap

Definition and difference between Hardware interrupt, Software Interrupt, Exception, Trap and Signals?


Interrupts can be categorized into two groups which are asynchronous interrupts (aka interrupt, hardware interrupt) and synchronous interrupts (aka exception). The former may arrive anytime, typically IO interrupts, the latter may only arrive after the execution of an instruction, for example when the cpu try to devide a number by 0 or a page fault. So that’s the difference between interrupts and exception.

A trap is a kind of exceptions, whose main purpose is for debugging (eg. notify the debugger that an instruction has been reached).

A software interrupt (aka Programmed Exceptions) occur at the request of the programmer. They are used to implement system calls. Software interrupt is a considered to be an exception (because they are synchronous). Note that as far as Linux is concerned, software interrupt are handled by the CPU as trap so you might see somewhere else that system calls are implemented by trap.

Signals (or at least UNIX signals) are part of the inter process communication (IPC). They are just like asynchronous message that one process can send to another one. So I would not consider them to be interrupt or exception. But that what I think!

source: http://kerneltrap.org/node/6314

2 thoughts on “Difference between software interrupt, exception, trap

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s