中断与异常的区别,以及他们与任务调度的关系

quote:

  The kernel distinguishes   between   interrupts   and   exceptions   in   the   following   way.  

  An interrupt is an asynchronous event (one that can occur at any time) that is unrelated to what the processor is executing. Interrupts are generated primarily by I/O devices, processor clocks, or timers, and they can be enabled (turned on) or disabled (turned off).  

  An exception, in contrast, is a synchronous condition that results from the execution of a particular instruction. Running a program a second time with the same data under the same conditions can reproduce exceptions. Examples of exceptions include memory access violations, certain debugger instructions, and divide-by-zero errors. The kernel also regards system service calls as exceptions (although technically they're system traps).

 

  1.软中断发生的时间是由程序控制的,而硬中断发生的时间是随机的  
  2.软中断是由程序调用发生的,而硬中断是由外设引发的  
  3.硬件中断处理程序要确保它能快速地完成它的任务,这样程序执行时才不会等侍较长时间

  4.软中断对应的门中的DPL要大于等于CPL(防止3级任务调用0级异常处理程序);硬中断没有这个要求

 

   一般情况下,调用中断或异常处理程序不会涉及任务切换,仅仅是任务内部的函数调用。只有当通过IDT中任务门来访问异常或中断处理过程时,才会导致任务切换,也就是说,使用单独的任务来处理中断或异常处理过程,此时,任务段(TSS)中的“前一任务链接”字段放置了被中断任务的TSS选择符(16位)。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值