Linux signals(一)理论、C语言捕获信号并处理

首先需要知道signals和interrupt是不同的。
signal属于进程通信机制的一种实现方式
(还有的实现为:Pipes、Sockets
其中Sockets又可分为: System V IPC Mechanisms、Message Queues、Semaphores、Shared Memory)
关于进程间通信,具体参见:Chapter 5
Interprocess Communication Mechanisms

而具体的不同,别人的回答是:

Interrupts can be viewed as a mean of communication between the CPU and the OS kernel. Signals can be viewed as a mean of communication between the OS kernel and OS processes.

Interrupts may be initiated by the CPU (exceptions -e.g.: divide by zero, page fault), devices (hardware interrupts -e.g.: input available), or by a CPU instruction. They are eventually managed by the CPU, which “interrupts” the current task,and invokes an 0S-kernel provided ISR/interrupt handler

Signals may be initiated by the OS kernel(下面的实例也揭示了这一点), or by a process( kill() ). They are eventually managed by the OS kernel, which delivers them

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值