Linux Kernel原始碼分析中的終極問題

來源:互聯網
上載者:User

        吼吼,文章名字很唬人啊。這裡只是記錄我在研究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應該可以保證傳遞性。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.