日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux为什么要禁止内核抢占,为什么linux在内核代码持有自旋锁后禁用内核抢占?...

發布時間:2024/9/27 linux 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux为什么要禁止内核抢占,为什么linux在内核代码持有自旋锁后禁用内核抢占?... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我是

Linux的新手,正在閱讀Rubini& amp;的Linux設備驅動程序.科比特.我對一個與自旋鎖相關的陳述感到困惑;這本書說明

If a nonpreemptive uniprocessor system ever went into a

spin on a lock, it would spin forever; no other thread would ever be able to obtain

the CPU to release the lock. For this reason, spinlock operations on uniprocessor systems

without preemption enabled are optimized to do nothing, with the exception of

the ones that change the IRQ masking status.

書還說明了這一點

The kernel preemption case is handled by the spinlock code itself. Any time kernel

code holds a spinlock, preemption is disabled on the relevant processor. Even uniprocessor

systems must disable preemption in this way to avoid race conditions.

問題:在單處理器系統上,如果內核代碼(代表用戶進程執行)持有自旋鎖,則禁用內核搶占,那么另一個進程怎么能有機會運行并因此嘗試獲取自旋鎖?為什么Linux內核會在內核代碼持有自旋鎖時禁用內核搶占?

總結

以上是生活随笔為你收集整理的linux为什么要禁止内核抢占,为什么linux在内核代码持有自旋锁后禁用内核抢占?...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。