Interrupts, hardware exceptions, and signals

> 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值