Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paged pool memory or Nonpaged pool memory ?? (windows driver development)

I am newbie in windows driver development. I just want to know , a global variable in a driver will use paged pool memory or non paged pool memory ?

Thanks and Regards

Navaneeth

like image 903
Navaneeth Avatar asked Apr 28 '09 08:04

Navaneeth


People also ask

What is nonpaged pool RAM?

Non-paged memory pool is data in the computer's RAM used by the kernel and drivers of the operating system. The non-paged pool is never swapped to the disk (to the paging file), it is always stored only in the physical memory.

Will the amount of paged memory always be greater than nonpaged memory?

No - it's not necessarily true for either very old OR very new systems. A device with no swapping device ( e.g. very early PC's without hard drives ) would have zero paged memory.

What is kernel memory paged and nonpaged?

Kernel memory is memory allocated/used by the operating system itself, this includes the kernel and any drivers. Paged kernel memory can be written to a page file, if one exists. Nonpaged kernel memory will not ever be written to a page file.

What is paged pool size?

Paged pool is amount of kernel and device driver memory that CAN spill over from physical memory into the slow page file (source). Nonpaged pool is the amount of kernel and device driver memory that must stay in physical memory.


2 Answers

Depends. The Non paged pool should be reserved for memory that must stay in RAM so if you are doing something critical that would affected by a memory page from disk operation then use non paged.

See here for more info.

Looking at this (though it discusses c++ as opposed to C) it would seem that by default the globals can be located in either by #pragma. Also on p22 of this we see how to do this. Finally this discuss here we see that the data segment should be non pagagable by default.

like image 192
Preet Sangha Avatar answered Sep 17 '22 12:09

Preet Sangha


Global variables in a kernel mode driver are allocated from NonPagedPool.

You can also use the device extension (when you call IoCreateDevice), it is always allocated from NonPaged memory.

I hope this helps, Martin

like image 38
Martin Avatar answered Sep 21 '22 12:09

Martin