中断和异常上下文有什么区别?

发布于 2024-12-02 23:36:21 字数 84 浏览 4 评论 0原文

两者之间有什么重大区别吗?有没有什么事情可以在其中一个可以完成而另一个却不能完成?例如,在修改页面错误处理程序时,我是否需要比修改计时器处理程序更加小心?

Is there any major difference between the two? Is there anything that can be done in one and not the other? Do I need to take more care when modifying, for example, the page fault handler than a timer handler?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦纸 2024-12-09 23:36:21

中断是异常类型之一。异常有四类:中断、陷阱、故障和中止。中断是异步发生的,由处理器外部 I/O 设备的信号触发。当异常处理程序处理完该中断(异常处理)后,处理程序总是会返回到下一条指令。

Interrupt is one of the classes of exception. There are four classes of exception: interrupt, trap, fault and abort. Interrupt occurs asynchronously and it is triggered by signal which is from I/O device that are external by processor. After exception handler finish handling this interrupt(exception processing), handler will always return to next instruction.

雾里花 2024-12-09 23:36:21

中断和异常都会改变程序流程。这
不同之处
两者之间的区别在于中断是用来处理
外部事件
(串口、键盘)和异常用来处理
操作说明
错误(除以零,未定义的操作码)。

中断由处理器在完成后处理
当前的
操作说明。如果它在其中断引脚上发现信号,它
会抬头看
中断处理程序在中断表中的地址
并通过
那个常规控制。从中断返回后
处理程序
例程,它将恢复程序执行
指令后
中断指令。

另一方面,异常分为三种。
这些都是
故障、陷阱和中止。检测并维修故障

错误指令之前的处理器。陷阱是
维修后
导致陷阱的指令。用户定义的中断
进入这个
类别又可以说是陷阱;这包括 MS-
DOS INT 21小时
例如,软件中断。中止仅用于
信号严重
系统出现问题,无法再进行操作。

研究:https://www.allinterview.com/ showanswers/14289/distinguish- Between-interrupts-and-exceptions.html

Interrupts and exceptions both alter the program flow. The
difference
between the two is that interrupts are used to handle
external events
(serial ports, keyboard) and exceptions are used to handle
instruction
faults, (division by zero, undefined opcode).

Interrupts are handled by the processor after finishing the
current
instruction. If it finds a signal on its interrupt pin, it
will look up
the address of the interrupt handler in the interrupt table
and pass
that routine control. After returning from the interrupt
handler
routine, it will resume program execution at the
instruction after the
interrupted instruction.

Exceptions on the other hand are divided into three kinds.
These are
Faults, Traps and Aborts. Faults are detected and serviced
by the
processor before the faulting instructions. Traps are
serviced after
the instruction causing the trap. User defined interrupts
go into this
category and can be said to be traps; this includes the MS-
DOS INT 21h
software interrupt, for example. Aborts are used only to
signal severe
system problems, when operation is no longer possible.

Research at: https://www.allinterview.com/showanswers/14289/distinguish-between-interrupts-and-exceptions.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文