基于各种参考,我在Linux中对 signals的主观定义是用于将特定事件的发生通知进程的触发器.此处的事件可能是指软件异常.此外,信号也可能是用于IPC机制." 我的问题是
Based on various references, my subjective definition of signals in Linux is "The triggers that are used to notify the processes about an occurrence of a specific event.Event here may refer to a software exception.Additionally signals may also be used for IPC mechanisms." The questions I have are
- 我假设只有异常(软件中断)是通过信号通知的.硬件中断的情况如何?
- 信号的各种来源是什么?在我看来,内核始终是信号的来源.(用于IPC时除外)
- 信号处理程序和ISR之间有什么区别?.
- 信号阻止和中断屏蔽之间有区别吗?
中断可以看作是CPU与OS内核之间通信的一种方式.信号可以看作是OS内核与OS进程之间通信的一种方式.
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.
中断可以由CPU(异常-例如:被零除,页面错误),设备(硬件中断-例如:可用输入)或CPU指令(陷阱-例如:系统调用,断点)启动.它们最终由CPU管理,从而中断"当前任务,并调用OS内核提供的ISR/中断处理程序.
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 (traps - e.g: syscalls, breakpoints). They are eventually managed by the CPU, which "interrupts" the current task, and invokes an OS-kernel provided ISR/interrupt handler.
信号可以由OS内核(例如SIGFPE,SIGSEGV,SIGIO)或进程(kill())启动.它们最终由OS内核管理,然后将它们传递到目标线程/进程,并调用通用操作(忽略,终止,终止和转储核心)或进程提供的信号处理程序.
Signals may be initiated by the OS kernel (e.g: SIGFPE, SIGSEGV, SIGIO), or by a process(kill()). They are eventually managed by the OS kernel, which delivers them to the target thread/process, invoking either a generic action (ignore, terminate, terminate and dump core) or a process-provided signal handler.
更多推荐
发出信号并中断比较
发布评论