> 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
中断、信号与硬件异常的区别
本文详细解释了计算机系统中中断、信号及硬件异常之间的关键区别。中断由硬件触发并由内核处理,信号则由内核发送给用户级程序进行处理。硬件异常通常是由运行中的代码产生的非法操作引发,其处理方式类似于中断但不可被阻止。
301

被折叠的 条评论
为什么被折叠?



