发出信号并中断比较

编程入门 行业动态 更新时间:2024-10-11 17:26:15
本文介绍了发出信号并中断比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

更多推荐

发出信号并中断比较

本文发布于:2023-10-09 05:32:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1474841.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:信号

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!