> Whats the difference between Interrupts, hardware exceptions, and
> signals
Interrupts and signals are somehow similar, there is however one
major difference between them. An interrupt is sent by the
hardware, and is handled by the kernel. A signal is sent by the
kernel and is handled by the user mode program.
They can both be blocked if necesarry, a user mode program can
use a system call to block signals. The kernel can use special
instructions and access the IRQ controller to block IRQs.
What do you have in mind, when you say hardware exceptions? If
a piece of code does something impossible or just something it
is just not allowed to, the CPU will generate an exception.
Exception handling is similar to interrupt handling, but there
are a few major differences. First of all the interrupt is
generated by the hardware, and the exception is generated by
code running on the CPU. This makes the exception a
synchronous even and the interrupt an asynchronous event.
This difference also means that exceptions cannot be blocked,
it wouldn't make any sense since the code causing the
exception cannot continue before it has been handled.
When an exception is caused it must be handled by the kernel.
Sometimes the kernel just have to do something before the
program can be allowed to continue like copying a page, or
maybe loading it from disk. Other times the kernel will need
to generate a signal for the process, or kill it if no handler
is available.
--
Kasper Dupont
> signals
Interrupts and signals are somehow similar, there is however one
major difference between them. An interrupt is sent by the
hardware, and is handled by the kernel. A signal is sent by the
kernel and is handled by the user mode program.
They can both be blocked if necesarry, a user mode program can
use a system call to block signals. The kernel can use special
instructions and access the IRQ controller to block IRQs.
What do you have in mind, when you say hardware exceptions? If
a piece of code does something impossible or just something it
is just not allowed to, the CPU will generate an exception.
Exception handling is similar to interrupt handling, but there
are a few major differences. First of all the interrupt is
generated by the hardware, and the exception is generated by
code running on the CPU. This makes the exception a
synchronous even and the interrupt an asynchronous event.
This difference also means that exceptions cannot be blocked,
it wouldn't make any sense since the code causing the
exception cannot continue before it has been handled.
When an exception is caused it must be handled by the kernel.
Sometimes the kernel just have to do something before the
program can be allowed to continue like copying a page, or
maybe loading it from disk. Other times the kernel will need
to generate a signal for the process, or kill it if no handler
is available.
--
Kasper Dupont