操作系统学习之中断-interrupt

本文探讨了中断和陷阱的概念,解释了它们之间的关键差异,并详细阐述了如何在多周期CPU设计中实现中断和陷阱处理。通过实例分析,帮助读者深入理解硬件和CPU内部的异常处理机制。
中断(interrupt)分为硬件中断和软件中断
硬件中断又可分为内部中断和外部中断
80386把外部中断称为“中断”,而内部中断则称为异常(exception)
trap大概就是指硬件内部中断了,不知道这里理解的对不对
下面附上google上查到的资料
本文仅供个人参考记录,如有不对之处,还望指正,谢谢

An interrupt is generally initiated by an I/Odevice, and causes the CPU to stop what it's doing, save its context, jump to the appropriate interrupt service routine, complete it, restore the context, and continue execution. For example, a serial device may assert the interrupt line and then place an interrupt vector number on the data bus. The CPU uses this to get the serial device interrupt service routine, which it then executes as above.
A trap is usually initiated by the CPU hardware. When ever the trap condition occurs (on arithmetic overflow, for example), the CPU stops what it's doing, saves the context, jumps to the appropriate trap routine, completes it, restores the context, and continues execution. For example, if overflow traps are enabled, adding two very large integers would cause the overflow bit to be set AND the overflow trap service routine to be initiated.

Read more: http://wiki.answers.com/Q/What_is_key_difference_between_a_trap_and_interrupt#ixzz1ctyEvxFy


Exceptions and interrupts are unexpected events that disrupt the normal flow of instruction execution. An exception is an unexpected event from within the processor. An interrupt is an unexpected event from outside the processor. You are to implement exception and interrupt handling in your multicycle CPU design.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值