Nonpaged Pool(非分頁池) 和 Paged Pool(分頁池) 在Windows中的用處

來源:互聯網
上載者:User

很多DBA對nonpage pool 和 paged pool 搞不太清楚幹嘛用的,看perfmon中的說明也看得稀裡糊塗。找到一個資料就翻譯一下。

From:http://blogs.technet.com/b/markrussinovich/archive/2009/03/26/3211216.aspx

Nonpaged Pool(非分頁池)

The kernel and device drivers use nonpaged pool to store data that might be accessed when the system can’t handle page faults. The kernel enters such a state when it executes interrupt service routines (ISRs) and deferred procedure calls (DPCs), which are functions related to hardware interrupts. Page faults are also illegal when the kernel or a device driver acquires a spin lock, which, because they are the only type of lock that can be used within ISRs and DPCs, must be used to protect data structures that are accessed from within ISRs or DPCs and either other ISRs or DPCs or code executing on kernel threads. Failure by a driver to honor these rules results in the most common crash code, IRQL_NOT_LESS_OR_EQUAL.

核心或者裝置驅動使用非分頁池來儲存可能訪問的資料,但是在訪問的時候又不能出現也錯誤。當核心執行中斷服務程式並且延遲調用過程的時候就會進入這種狀態,這個狀態和硬體中斷相關聯。當核心或者裝置驅動在這個狀態後,擷取了一個自旋鎖,頁錯誤也是不被允許的,自旋鎖是唯一能在延遲調用或者中斷服務程式中能用的鎖類型,用來保護被延遲程序呼叫和中斷服務程式訪問的資料,可能來自於延遲程序呼叫和中斷服務程式,也可能來自其他的延遲程序呼叫和中斷服務程式,或者其他的核心線程。如果驅動程式在執行整個規則的時候出錯會得到一個 IRQL_NOT_LESS_OR_EQUAL 的崩潰代碼

Nonpaged pool is therefore always kept present in physical memory and nonpaged pool virtual memory is assigned physical memory. Common system data structures stored in nonpaged pool include the kernel and objects that represent processes and threads, synchronization objects like mutexes, semaphores and events, references to files, which are represented as file objects, and I/O request packets (IRPs), which represent I/O operations.

非分頁池因此總是報錯在記憶體中,非分頁池的虛擬位址被物理地址分配。通用的系統資料結構被儲存在非分頁池中包含核心和代表進程和線程的對象,互斥對象,同步訊號量,引用檔案(代表檔案對象),和I/O請求包(代表I/O操作)

Paged Pool(分頁池)

Paged pool, on the other hand, gets its name from the fact that Windows can write the data it stores to the paging file, allowing the physical memory it occupies to be repurposed. Just as for user-mode virtual memory, when a driver or the system references paged pool memory that’s in the paging file, an operation called a page fault occurs, and the memory manager reads the data back into physical memory. The largest consumer of paged pool, at least on Windows Vista and later, is typically the Registry, since references to registry keys and other registry data structures are stored in paged pool. The data structures that represent memory mapped files, called sections internally, are also stored in paged pool.

分頁池,從字面意思來說,也就是可以存到系統的分頁檔案中,允許實體記憶體重新導向。如使用者模式的虛擬記憶體,當驅動或者系統引用分頁池記憶體在分頁檔案中,那麼一個操作就會調用頁錯誤,記憶體管理系統把資料從分頁檔案中讀取到實體記憶體。在windows vista和之後的版本,分頁池最大的使用者是註冊表,引用的註冊索引值和其他註冊表資料都是儲存在分頁池中。記憶體對應檔(內部叫做記憶體對象[Sections])也存在分頁池中。

 

Device drivers use the ExAllocatePoolWithTag API to allocate nonpaged and paged pool, specifying the type of pool desired as one of the parameters. Another parameter is a 4-byte Tag, which drivers are supposed to use to uniquely identify the memory they allocate, and that can be a useful key for tracking down drivers that leak pool, as I’ll show later.

裝置驅動可以使用ExAllocatePoolWithTag API來申請非分頁池和分頁池,可以使用參數來指定在那個類型的池中申請。另外一個參數是4個位元組的tag,用來唯一標示分配記憶體的驅動程式,並且在跟蹤驅動程式是否缺少池十分有用。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.