Linux Kernel源代码分析中的终极问题

        吼吼,文章名字很唬人啊。这里只是记录我在研究Linux Kernel源代码时碰到的有意思的,而目前不知道为什么的问题。

       

        * * * * *

        1)为什么Interrupt handler不能睡眠,或者更严格的说,被调度(rescheduled)

                目前引用最广泛,也最容易理解的解释是, 1)Interrupt context is time-critical because the interrupt handler interrupts the other code. Code should be quick and simple。2)Interrupt context is not associated with a process. The current macro is not relevant (although it points to the interrupted process). Without a backing process, interrupt context cannot sleep --- how would it ever reschedule?

                以我个人观点,这两条解释最多算作建议,即他建议你不要在Interrupt handler中睡眠,但你偏要睡眠他也没办法。既然kernel的scheduler会保存CPU的所有状态,从技术实现的可行性上说,应该可以对Interrupt handler进行调度,事实上只要调度被此Interrupt handler中断的process就行,即上面第二条解释的中说的current指向的与此Interrupt handler不相关的process。当然这样做会影响系统的相应速度,但这里只强调技术实现的可行性。

                这个想法应该很好验证。

          

         * * * *

         2)为什么read/write memory barrier不能保证transitivity,而general barrier可以保证

                  Documentation/memory_barriers.txt中给出的结论,不知道为什么。以我个人观点,从语义上来说read/write memory barrier应该可以保证传递性。




  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值