发出信号并中断比较 [英] Signals and interrupts a comparison

查看:113
本文介绍了发出信号并中断比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于各种参考,我在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.

这篇关于发出信号并中断比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆