Windows 32-bit Operating Systems implement a virtual memory system based on a flat 32-bit address space. 32-bits of address space translates into 4GB of virtual memory. A process can access up to 4GB of memory address space (using the /3GB switch changes this behavior – and we’ll cover that in a later post).
You can’t have a discussion of Memory Management basics, without distinguishing between Kernel-mode and User-mode memory. The system space (aka Kernel space) is the portion of the address space in which the OS and kernel-mode drivers reside. Only kernel-mode code can access this space. User-mode threads can access data only in the context of their own process. User-mode threads cannot access data within another processes space directly, nor can it access the system address space directly. Kernel-mode drivers are trusted by the OS and can access both kernel and user space. When a driver routine is called from a user thread, the thread’s data remains in the user-mode space. However, the kernel-mode driver can access the user-mode data for the thread and access the kernel-mode space.

OK – so looking at the diagram above, we can see how the 4GB memory address space is divided. Windows allocates the lower half of the 4GB address space (from 0x00000000 to 0x7FFFFFFF) to processes for their own unique private storage, and reserves the other half (from 0x80000000 to 0xFFFFFFFF) for the Operating System’s use. Virtual memory provides a view of memory that does not necessarily correspond to the physical layout of memory.
Kernel memory chart for Windows 2003 Server:
Memory
|
Default ( /PAE for 6-16GB )
|
/3GB
|
1GB
|
Free System PTE: 51k Paged Pool: 282MB |
Free System PTE: 32k Paged Pool: 163MB |
2GB
|
Free System PTE: 196k Paged Pool: 360MB |
Free System PTE: 16k Paged Pool: 262MB |
3GB
|
Free System PTE: 195k Paged Pool: 360MB |
Free System PTE: 14k |
4GB
|
Free System PTE: 106k Paged Pool: 336MB |
Free System PTE: 15k Paged Pool: 258MB |
6GB
|
Free System PTE: 186k Paged Pool: 366MB |
Free System PTE: 12k Paged Pool: 239MB |
8GB
|
Free System PTE: 182k Paged Pool: 366MB |
Free System PTE: 12k Paged Pool: 225MB |
12GB
|
Free System PTE: 175k Paged Pool: 366MB |
Free System PTE: 12k Paged Pool: 196MB |
16GB
|
Free System PTE: 167k Paged Pool: 366MB |
Free System PTE: 12k Paged Pool: 169MB |
What is /3GB?:
/3GB is a switch used within the Boot.ini to Increase the size of a user process address space from 2 GB to 3G B. This in-turn reduces the Kernel space from 2 GB to 1 GB. This is a positive aspect for virtual-memory-intensive applications such as database servers a larger address space can improve their performance. For an application to take advantage of this feature, however, two additional conditions must be met: the system must be running Windows 2000 Advanced Server or Datacenter Server or Windows 2003 (All Editions) and the application .exe must be flagged as a 3-GB-aware application
With the /3GB switch we enable 3 GB area of user-mode memory for programs to use. This feature can expand the virtual address range for user-mode memory from 0x0000000 through 0xBFFFFFF (the user-mode address range is typically from 0x00000000 through 0x7FFFFFFF). The range of memory that is available for kernel-mode components shrinks from 0x80000000-0xFFFFFFFF to 0xC0000000-0xFFFFFFFF.

What is /USERVA?:
Windows 2003 Servers and Windows XP SP1 incorporate a new /USERVA switch to work in conjunction with /3GB switch. You can use the /userva= switch for more precise tuning of user and kernel virtual memory space in the Windows Server 2003 family. Use this new switch with the /3GB switch in the Boot.ini file to tune the User-mode space to a value between 2 and 3 gigabytes (GB), with the difference being given back to Kernel mode.
Thanks,
Aresh
Useful Blogs:
Windows Internals Mark Russinovich’s: http://blogs.technet.com/markrussinovich/archive/2008/07/21/3092070.aspx
Memory Management – Demystifying /3GB : http://blogs.technet.com/askperf/archive/2007/03/23/memory-management-demystifying-3gb.aspx
Memory Management: http://blogs.technet.com/askperf/archive/2007/02/23/memory-management-101.aspx
Leave a Reply