水平触发和边缘触发对比

http://venkateshabbarapu.blogspot.com/2013/03/edge-triggered-vs-level-triggered.html

水平触发和边缘触发的区别

  • 水平触发:只有高电平或低电平才触发通知,只有在这两种状态才能得到通知
    • 如果是低电平触发,需要a pullup resistor to pull the line high
    • the interrupt handler has to poll each of the devices which are sharing the interrupt line to determine which device actually caused the interrupt:遍历查找发生问题的设备
  • 边缘触发:电平发生变化会触发通知(高电平到低电平,或低电平到高电平)
    • normally only have one device per interrupt line, although I remember that the PC had some scheme which allowed sharing, but it required extra HW for each interrupt source.常规情况只有一个设备,能很快找到源头

水平触发baby的故事【state】

  • Level triggered interrupt is like a baby. If the baby cries, you have to abandon whatever you are doing and feed the baby. You put her down. If she’s still crying, you need to attend her immediately again. As long as she’s crying, you serve her needs. You can get back to your work only when she’s quiet. If you are in the garden (interrupt disabled) when she starts to cry, then when you get into the house (enable interrupts) the first thing you will do is to see her. However, if she starts crying while you’re in the garden but goes back to sleep before you get back to the house, you will not even know about this incident.
  • baby只要哭,你就要放下手上的工作去照顾他

边缘触发baby的故事【event】

  • Edge trigger is like a baby cry monitor for deaf parents. The monitor has a red light which comes on when the baby starts to cry (i.e. there is sudden increase in the sound level in the room) and remains lit until you press a button on the device. If the baby starts to cry but stops it quicky, you will still see that she cried, even if you were in the garden while that happened. However, if she starts crying, the light comes on (interrupt request), then you press the button (interrupt acknowledge), the light will remain dark even if she keeps crying. The sound level in the room must drop then increase again for the light to come on.
  • baby哭声发生变化,你要放下手上的工作去照顾他

应用场景

  • 边缘触发:临时事件发生产生中断
  • 水平触发:持久性事件发生产生中断

其他

  • 防止中断丢失:
    • latch the interrupt request at the source
    • use level-sensitive interrupts
  • 特点
    • 水平触发: level type interrupt requires feedback to the interrupt source in order to reset it
    • 边缘触发:less-than-perfect hardware may generate a glitch due to noise or racing conditions that may get edge-triggered interrupt falsely asserted.
  • 缺点
    • 水平触发:the level interrupt have tendency to slow the main application to a near dead crawl【因为中断触发,就要去处理中断】

水平触发和边缘触发优劣

https://hackernoon.com/level-triggering-and-reconciliation-in-kubernetes-1f17fe30333d

  • 错过触发

    • 如果系统没有对信号进行足够频繁的采样,可能会因为an edge transition, or for a short change 而错过触发
  • 丢失部分数据

    • 边缘触发:如果丢失的数据中有变化的数据,那可能错过触发
      • 原文中的例子很赞:a上升下降上升,正常a初始状态=1,最后应该=2,但是边缘触发错过了a的下降,最后a就经历两次上升=3
    • 水平触发:大部分观察到的信号是正确的,但可能有延迟
  • 协调期望状态和实际状态

    • k8s选用了水平触发,因为边缘触发需要发生改变才会触发
    • 而k8s是周期性的将期望状态和实际状态做对比,如果选择边缘触发的方法,采样的时间pod没有销毁或者新建成功,就无法触发边缘触发。
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值