Description of the kernel memory area in Windows NT

The 32 bit Windows can address 4 GB memory, which for each process it divided into a 2 GB user area and a 2 GB kernel area. The 2 GB kernel area is shared between all the processes. These two areas are also called virtual user address range and virtual system address range.

The kernel area is used to contain all system data structures and information. During the Windows startup the NT Executive allocates the kernel area and divides it into smaller areas.

  • Address tables for accessing physical memory and mapping to virtual memory. Like the Page Frame Number (PFN) list that keeps track of all the physical memory pages an their state (Is it in use ? Who uses it ? How many time has it been used ? etc.).
  • Memory pools for drivers to allocate buffers (paged and non-paged)
  • Page Table Entries (PTE) for addressing system resources like processes / threads / files / connections / IO-buffers.
  • File System Cache

The maximum size of the areas are fixed and depends on available physical memory. The fixed size makes it possible for an area to become depleted even though there is plenty of memory in the kernel area. If this happens, then it can either cause very low performance or that the machine crashes. Windows Vista changes this by making the areas dynamic.

Even if the maximum size is fixed, then the actual size of the different areas can grow and shrink depending on the load. If there is a lot of file activity then the file cache will grow, leaving less memory available for paged pool allocations. And if the paged pool allocations gets close to its maximum size, then the memory manager will start trimming by reclaiming memory from the file-cache and paging to disk, to make sure there is enough available RAM to handle the extra load. More Info MS KB312362, MS KB304101

Use the Windows Task Manager to see the size of paged and non-paged memory pools. Another way is to use Perfmon and Add Counters… from the Memory Performance Object (*Hint* notice the Explain-button):

  • Cache Bytes Peak
  • Free System Page Table Entries
  • Pool Nonpaged Allocs
  • Pool Nonpaged Bytes
  • Pool Paged Allocs
  • Pool Paged Bytes

Change how Windows calculates paged-pool size (Can improve driver performance):

[HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Control \Session Manager \Memory Management]
PagedPoolSize = 0 (Default = 0, Max = 0xFFFFFFFF, Calculated = 0)

Note if wanting a minimum value to give better room for PTE or System File Cache, then specify a value of 192000000 (192 MByte).

Note the max paged-pool size is 650 MByte for Win2k3 (470 MByte for Win2k/WinXP, 192 MByte for WinNT4), and 256 MByte for the non-paged-pool (128 MByte for WinNT4). Independent of the amount of physical memory.

More Info MS KB177415
More Info MS KB304101
More Info MS KB312362

Change how Windows calculates Page Table Entries (Can allow addressing of large video memory areas):

[HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Control \Session Manager \Memory Management]
SystemPages = 0 (Default = 0, Max = 0xFFFFFFFF, Calculated = 0)

Note if wanting a minimum value to give better room for paged-pool or System File Cache, then use the default value of 0.

Note the max PTE size is 1.3 GByte for Win2k3/WinXP (470 Mbyte for Win2k, 192 MByte for WinNT4). Independent of the amount of physical memory.

More Info MS KB189327
More Info MS KB247904
More Info MS KB256004
More Info MS KB313707
More Info MS KB818894

Note there exists a BOOT.INI setting /3GB, which enables 4GT RAM tuning. Changing how Windows divides the 4 GB, so the user area gets 3 GB and the kernel area only gets 1 GB. This can be useful when using large address aware applications, which supports more than 2 GB memory (Ex. MS Exchange/SQL Server). Naturally this setting puts a strain on the available kernel resources, so one have to be careful with it. Windows 2003 introduces an extra BOOT.INI setting /USERVA, which allows one to better configure the boundary between the kernel- and user-memory area.

Note the registry size limit (RSL) or maximum registry size is by default limited to 25% of the pagepool size, but can be increased to 80% (RegistrySizeLimit). More Info MS KB124594.
If changing the RSL through the user interface, and specifies a value that requires a larger paged-pool size, then it will modify the values of PagedPoolSize and SystemPages, which can lead to undesirable behavior. More Info MS KB166840.
The registry size limitation has been removed with Windows XP/2003. More Info MS KB292726.
The size of system registry hive is still limited (16 MB for Win2k/32 MB for Win2k3) by the memory available to the startup proces. More Info MS KB302594

Note if wanting to access more than 4 GB RAM on 32 bit Windows then PAE must be activated, which requires that the CPU hardware has 36 bit memory registers (instead of 32 bit) so it can address up to 64 GByte of RAM. The Windows address tables becomes 64 bit wide (8 bytes instead of 4 bytes each) and requires more kernel memory to hold the memory page address table. PAE will still serve 32 bit addresses to the applications, so it is possible to run multiple applications (or virtual machines) without running out of available physical RAM. If an application wants to access more than 2 GByte memory, then it should use the Address Windowing Extensions (AWE) API to access the extra memory available through PAE. More Info AWE Performance

Note if wanting a lot of kernel memory in 32 bit Windows, then one should not install more than 4 GByte RAM in the computer. Because the kernel is limited to only 2 GByte independent of physical memory, and when adding more RAM, then it will use kernel memory for mapping the extra RAM to virtual memory.

Note some motherboards reserves the upper part of the 32 bit address space for system BIOS and PCI devices. Therefore if having 4 GB RAM (or more) installed, then one might loose 1 GB of memory because it has been reserved, so the operating system only sees 3 GB RAM. Some motherboards solves this issue by having a BIOS option that allows remapping of the reserved memory area above the 4 GB boundary, also called “memory hole”. Because some device drivers doesn’t support remapping of the reserved memory area, then XP SP2 disables the remapping to improve driver compatibility. More Info MS KB888137, MS KB888137

More Info MS Technet (Excellent article about managing kernel memory)
More Info MSDN (The Virtual-Memory Manager in Windows NT)
More Info MSDN - Memory Limits of each Windows version