Difference b/w software interrupt/exception/trap

Submitted by gaggarwal
on March 9, 2006 - 12:50am

Hi all

Can anybody tell me the exact definition and difference between Hardware interrupt, Software Interrupt, Exception, Trap and Signals?
Is Signals are same as Software interrupt?( I am confused because some authors treat them as similar but others mentioned them as different)
What about the Exception and Software Interrupt?
What is the realtionship between Software Interrupts, Exception and System Calls??
Is this true that System calls are always handled by the Software Interrupts??

If possible then please mention any good link to study about them..

Thanks in advance

Hi, Interrupts can be catego

Petch
on
March 9, 2006 - 5:20am

Hi,
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!

Hope this help.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.