KiActivateWaiterQueue函數和Queue->Header.WaitListHead隊列等待列表的關系

???
?

第一部分:
??????????? if (Thread->ApcState.KernelApcPending &&
??????????????? (Thread->SpecialApcDisable == 0) &&
??????????????? (Thread->WaitIrql < APC_LEVEL)) {

??????????? } else {


??????????????? //
??????????????? // Insert wait block in object wait list.
??????????????? //

??????????????? InsertTailList(&Queue->Header.WaitListHead, &WaitBlock->WaitListEntry);


VOID
FORCEINLINE
InsertTailList(
??? IN PLIST_ENTRY ListHead,
??? IN PLIST_ENTRY Entry
??? )
{
??? PLIST_ENTRY Blink;

??? Blink = ListHead->Blink;
??? Entry->Flink = ListHead;
??? Entry->Blink = Blink;
??? Blink->Flink = Entry;
??? ListHead->Blink = Entry;
}

//LIFO隊列


第二部分:


NTSTATUS
KeDelayExecutionThread (
??? IN KPROCESSOR_MODE WaitMode,
??? IN BOOLEAN Alertable,
??? IN PLARGE_INTEGER Interval
??? )
{


??????????? //
??????????? // If the current thread is processing a queue entry, then attempt
??????????? // to activate another thread that is blocked on the queue object.
??????????? //

??????????? Queue = Thread->Queue;
??????????? if (Queue != NULL) {
??????????????? KiActivateWaiterQueue(Queue);
??????????? }


NTSTATUS
KeWaitForMultipleObjects (
??? IN ULONG Count,
??? IN PVOID Object[],
??? IN WAIT_TYPE WaitType,
??? IN KWAIT_REASON WaitReason,
??? IN KPROCESSOR_MODE WaitMode,
??? IN BOOLEAN Alertable,
??? IN PLARGE_INTEGER Timeout OPTIONAL,
??? IN PKWAIT_BLOCK WaitBlockArray OPTIONAL
??? )
{
??????????? //
??????????? // If the current thread is processing a queue entry, then attempt
??????????? // to activate another thread that is blocked on the queue object.
??????????? //

??????????? Queue = Thread->Queue;
??????????? if (Queue != NULL) {
??????????????? KiActivateWaiterQueue(Queue);
??????????? }

NTSTATUS
KeWaitForSingleObject (
??? IN PVOID Object,
??? IN KWAIT_REASON WaitReason,
??? IN KPROCESSOR_MODE WaitMode,
??? IN BOOLEAN Alertable,
??? IN PLARGE_INTEGER Timeout OPTIONAL
??? )
{
????????????? //
??????????? // If the current thread is processing a queue entry, then attempt
??????????? // to activate another thread that is blocked on the queue object.
??????????? //

??????????? Queue = Thread->Queue;
??????????? if (Queue != NULL) {
??????????????? KiActivateWaiterQueue(Queue);
??????????? }

第三部分:

FORCEINLINE
VOID
KiActivateWaiterQueue (
??? IN PRKQUEUE Queue
??? )

/*++

Routine Description:

??? This function is called when the current thread is about to enter a
??? wait state and is currently processing a queue entry. The current
??? number of threads processign entries for the queue is decrement and
??? an attempt is made to activate another thread if the current count
??? is less than the maximum count, there is a waiting thread, and the
??? queue is not empty.

??? N.B. It is possible that this function is called on one processor
???????? holding the dispatcher database lock while the state of the
???????? specified queue object is being modified on another processor
???????? while holding only the queue object lock. This does not cause
???????? a problem since holding the queue object lock ensures that
???????? there are no waiting threads.

Arguments:

??? Queue - Supplies a pointer to a dispatcher object of type event.

Return Value:

??? None.

--*/

{

??? PRLIST_ENTRY Entry;
??? PRKTHREAD Thread;
??? PRKWAIT_BLOCK WaitBlock;
??? PRLIST_ENTRY WaitEntry;

??? //
??? // Decrement the current count of active threads and check if another
??? // thread can be activated. If the current number of active threads is
??? // less than the target maximum number of threads, there is a entry in
??? // in the queue, and a thread is waiting, then remove the entry from the
??? // queue, decrement the number of entries in the queue, and unwait the
??? // respectiive thread.
??? //

??? Queue->CurrentCount -= 1;
??? if (Queue->CurrentCount < Queue->MaximumCount) {
??????? Entry = Queue->EntryListHead.Flink;
??????? WaitEntry = Queue->Header.WaitListHead.Blink;//LIFO隊列
??????? if ((Entry != &Queue->EntryListHead) &&
??????????? (WaitEntry != &Queue->Header.WaitListHead)) {

??????????? RemoveEntryList(Entry);
??????????? Entry->Flink = NULL;
??????????? Queue->Header.SignalState -= 1;
??????????? WaitBlock = CONTAINING_RECORD(WaitEntry, KWAIT_BLOCK, WaitListEntry);
??????????? Thread = WaitBlock->Thread;
??????????? KiUnwaitThread(Thread, (LONG_PTR)Entry, 0);
??????? }
??? }

??? return;
}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/pingmian/76466.shtml
繁體地址,請注明出處:http://hk.pswp.cn/pingmian/76466.shtml
英文地址,請注明出處:http://en.pswp.cn/pingmian/76466.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

讓DeepSeek API支持聯網搜索

引子 DeepSeek官網注冊的API token是不支持聯網搜索的&#xff0c;這導致它無法輔助分析一些最新的情況或是幫忙查一下互聯網上的資料。本文從實戰角度提供一種穩定可靠的方法使得DeepSeek R1支持聯網搜索分析。 正文 首先登錄火山方舟控制臺&#xff0c;https://www.volcen…

生物信息Rust-01

前言-為什么想學Rust&#xff1f; 一直想多學一門編譯語言&#xff0c;主要有幾個原因吧&#xff08;1. 看到一位老師實驗室要求需要掌握一門編譯語言&#xff1b;2. 自己享想試著開發一些實用的生信工具&#xff0c;感覺自己現在相比于數據分析&#xff0c;探索生物學層面的意…

字符串與相應函數(上)

字符串處理函數分類 求字符串長度&#xff1a;strlen長度不受限制的字符串函數&#xff1a;strcpy,strcat,strcmp長度受限制的字符串函數:strncpy,strncat,strncmp字符串查找&#xff1a;strstr,strtok錯誤信息報告&#xff1a;strerror字符操作&#xff0c;內存操作函數&…

asm匯編源代碼之文件操作相關

提供7個子程序:   1. 關閉文件 FCLOSE   2. 打開文件 FOPEN   3. 文件大小 FSIZE   4. 讀文件 FREAD   5. 寫文件 FWRITE   6. 建立文件 FCREATE   7. 讀取或設置文件指針 FPOS 具體功能及參數描述如下 ; ---------------------------- FCLOSE PROC  FAR ; IN…

[Dify] 使用 Docker 本地部署 Dify 并集成 Ollama 模型的詳細指南

在 AI 應用快速發展的今天&#xff0c;開源項目如 Dify 正成為構建本地化 AI 應用的利器。通過 Dify&#xff0c;你可以輕松地集成不同的大語言模型&#xff08;LLM&#xff09;&#xff0c;如 Ollama&#xff0c;并快速創建可交互的 AI 應用。本篇文章將帶你一步步通過 Docker…

Spring Boot 測試詳解,包含maven引入依賴、測試業務層類、REST風格測試和Mock測試

Spring Boot 測試詳解 1. 測試依賴引入 Spring Boot 默認通過以下 Maven 依賴引入測試工具&#xff1a; <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</s…

DevOps與功能安全:Perforce ALM通過ISO 26262合規認證,簡化安全關鍵系統開發流程

本文來源perforce.com&#xff0c;由Perforce中國授權合作伙伴、DevSecOps解決方案提供商-龍智翻譯整理。 近日&#xff0c;Perforce ALM&#xff08;原Helix ALM&#xff09;通過了國際權威認證機構 TV SD的ISO 26262功能安全流程認證&#xff01;該認證涵蓋Perforce ALM解決方…

Android11車載WiFi熱點默認名稱及密碼配置

一、背景 基于車廠信息安全要求,車載熱點默認名稱不能使用統一的名稱,以及默認密碼不能為簡單的1~9。 基于舊項目經驗,組裝工廠自動化測試及客戶整車組裝的時候均存在多臺設備同時打開,亦不太推薦使用統一的熱點名稱,連接無法區分。 二、需求 根據客戶的要求,默認名稱…

MacOs java環境配置+maven環境配置踩坑實錄

oracl官網下載jdk 1.8的安裝包 注意可能需要注冊&#xff01;&#xff01;&#xff01; 下載鏈接&#xff1a;下載地址點擊 注意晚上就不要下載了 報錯400 &#xff01;&#xff01;&#xff01; 1.點擊安裝嘛 2.配置環境變量 export JAVA_HOME/Library/Java/Java…

如何解讀 /proc/net/netstat

在刷了屏的川普&#xff0c;關稅&#xff0c;AI 大模型和 RDMA 之外的一股清流&#xff0c;來點實用的。 眾所周知 /proc/net/netstat 很難讀&#xff0c;且 netstat 并不是每個系統上都支持 -s&#xff0c;那么對齊該文件給出一個可讀的輸出就是一件高尚的事。可以用 column …

漢化進度100%

P3834 #include<bits/stdc.h> #define int long long #define 定義整型變量 int #define 這是一個常量 const #define 無返回值函數 void #define 這是一個循環條件在后面 for #define 定義結構體 struct #define 如果 if #define 否則 else #define 定義無返回值的 sig…

基于SpringBoot的動物救助中心系統(源碼+數據庫)

500基于SpringBoot的動物救助中心系統&#xff0c;本系統共分為2個角色&#xff1a;系統管理員、用戶&#xff0c;主要功能如下 【管理員】&#xff1a; 1. 登錄&#xff1a;管理員可以通過登錄系統來管理各種功能。 2. 用戶管理&#xff1a;管理員可以查看用戶列表&#xff0…

rockylinux 8 9 升級到指定版本

rockylinux 8 update 指定版本 rockylinux 歷史版 所有版本rockylinux 最新版 所有版本vault歷史版 pub最新版(https://dl.rockylinux.org)地址后面增加不同名稱 echo "delete repos" rm -rf /etc/yum.repos.d/*echo "new rockylinux repo" cat <<EO…

聚焦AI與大模型創新,紫光云如何引領云計算行業快速演進?

【全球云觀察 &#xff5c; 科技熱點關注】 隨著近年來AI與大模型的興起&#xff0c;云計算行業正在發生著一場大變局。 “在2025年春節期間&#xff0c;DeepSeek兩周火爆全球&#xff0c;如何進行私域部署成了企業關心的問題。”紫光云公司總裁王燕平強調指出&#xff0c;AI與…

React8+taro開發微信小程序,實現lottie動畫

安裝核心依賴 npm install lottie-miniprogram tarojs/plugin-html --save修改 Taro 配置 (config/index.js) const config {plugins: [tarojs/plugin-html,// 其他插件...],mini: {canvas: true,webpackChain(chain) {chain.merge({module: {rule: {lottie-loader: {test: …

有效壓縮 Hyper-v linux Centos 的虛擬磁盤 VHDX

參考&#xff1a; http://www.360doc.com/content/22/0505/16/67252277_1029878535.shtml VHDX 有個不好的問題就是&#xff0c;如果在里面存放過文件再刪除&#xff0c;那么已經使用過的空間不會壓縮&#xff0c;導致空間一直被占用。那么就需要想辦法壓縮空間。 還有一點&a…

【力扣hot100題】(089)最長有效括號

這題目真是越做越難了。 但其實只是思路很難想到&#xff0c;一旦會了方法就很好做。 但問題就在方法太難想了…… 思路還是只要遍歷一遍數組&#xff0c;維護動態規劃數組記錄截止至目前位置選取該元素的情況下有效括號的最大值。 光是知道這個還不夠&#xff0c;看了答案…

Ajax------免刷新地前后端交互

本文略帶PHP代碼需要在PHP環境下使用 介紹 AJAX (Asynchronous JavaScript and XML) 是一種創建快速動態網頁應用的開發技術&#xff0c;它允許網頁在不重新加載整個頁面的情況下&#xff0c;與服務器交換數據并更新部分網頁內容。例如&#xff0c;在我們做爬蟲的時候發現有些…

Android 中支持舊版 API 的方法(API 30)

Android 中最新依賴庫的版本支持 API 31 及以上版本&#xff0c;若要支持 API30&#xff0c;則對應的依賴庫的版本就需要使用舊版本。 可通過修改模塊級 build.gradle 文件來進行適配。 1、android 標簽的 targetSdk 和 compileSdk 版本號 根據實際目標設備的 android 版本來…

JDBC注入無外網(上):從HertzBeat聊聊SnakeYAML反序列化

上周日聯合Ar3h 師傅一起&#xff0c;在【代碼審計知識星球】里發布了一個Springboot的小挑戰&#xff1a;https://t.zsxq.com/tSBBZ&#xff0c;這個小挑戰的核心目標是在無法連接外網的情況下&#xff0c;如何利用PSQL JDBC注入漏洞。我會分兩篇文章來講講Java安全的不出網利…