What Is 4GT?
Updated: March 28, 2003
Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2
What Is 4GT?
In this section
The technology called 4-gigabyte tuning (4GT), also known as application memory tuning, or the /3GB switch, is one of two technologies that increase the amount of physical memory available to user mode applications. The other technology is Physical Address Extension (PAE) X86. For more information about PAE X86, see “PAE X86 Technical Reference.”
4GT allows memory-intensive applications running on Windows Server 2003, Enterprise Edition, or Windows Server 2003, Datacenter Edition, 32-bit, to use 50 percent more virtual memory by making less virtual memory available to the operating system. In addition, 4GT can be used on Windows Server 2003, Standard Edition, but only in non-production environments.
Windows Server 2003, Standard Edition; Windows Server 2003, Enterprise Edition; and Windows Server 2003, Datacenter Edition, provide applications with a flat 32-bit virtual address space that can describe up to 4 gigabytes (GB) of virtual memory. The address space is usually split so that 2 GB of virtual address space is directly accessible to the applications and the other 2 GB is only accessible to the Windows executive software (also known as the kernel). Because of this 2 GB virtual memory limit, applications that are memory intensive and that manage their memory directly through their own caching methods, such as database management systems (DBMS), can experience reduced performance.
4GT makes more of the computer’s virtual memory available to applications by making less virtual memory available to the operating system. By enabling 4GT, applications are able to access 3 GB of virtual memory instead of the 2 GB normally allocated for user mode processes. This is a 50 percent increase in virtual memory, allowing more data to be cached and potentially significantly increasing performance.
Common 4GT Scenarios
4GT is most commonly used when servers are hosting memory intensive applications, such as database management systems, the performance of which is directly affected by the availability of physical memory. However, it would be ineffective for every application to automatically be provided with the 3 GB address space that 4GT allows. Thus, to provide a selective use of 4GT, 4GT must first be explicitly enabled in the operating system and the application must also be explicitly configured to make use of the extended memory. For more information about 4GT, see “How 4GT Works.”
4GT should not be used if either of the following is true:
Greater than 16 GB of physical memory are available and PAE X86 is enabled on the server.
Important performance characteristics of the application are adversely affected by limiting the kernel to 1 GB of RAM, for example, more than 1 GB of RAM might be needed to support the maximum number of concurrent connections.
4GT is not required on the 64-bit versions of the Windows Server 2003 family.
Technologies Related to 4GT
The following technologies and components are integral in understanding 4GT.
The 32-bit versions of Windows are able to address 232 bytes (4 GB) of memory by default. Windows splits that memory, allocating 2 GB of memory to the kernel and up to 2 GB of memory to each application’s private address space. This is done in order to provide protection for both the operating system and the applications. The kernel mode functions get 2 GB so that they will have enough room to perform mandatory processes without running out of space. User mode applications therefore cannot address memory in the kernel mode space and accidentally corrupt kernel mode memory.
Each application can also utilize up to 2 GB of memory. This is true regardless of the number of applications on the server and despite the operating system’s ability to natively recognize only 4 GB of total memory. If the total memory requirements of all applications exceed 4 GB, the memory manager uses a paging file to substitute for RAM. This process is described in the following paragraphs.
The memory manager is responsible for allocating and tracking memory assignments for both the kernel and applications. The memory manager translates virtual memory addresses used by the operating system and applications to actual physical memory locations. The translation of virtual memory to physical memory is transparent to the applications. User mode processes are never able to directly write to real memory and never actually know where their data resides. A user mode process can request a block of memory and write to it. The data written to the memory location might be written to real memory, or might be written to a paging file. A paging file (also known as a swap file) is a file on the hard disk that the memory manager uses to hold data that does not fit in memory. The memory manager moves data from the paging file to memory as needed and moves data from memory to the paging file to make room for new data.
The paging process allows the operating system to overcome its native 2 GB limit. However, it also has a direct impact on performance because of the time necessary to write or retrieve data from disk. 4GT modifies the way the memory manager works, allowing user mode applications that can effectively use greater virtual address space to achieve higher performance.
The kernel address space can also use up to 2 GB of address virtual memory, but all processes in the kernel space share the same 2 GB. Each process does not get its own unique memory space use without affecting the other kernel mode processes. Much of the memory in the kernel mode space also uses a virtual address and depending upon the function, some memory can be paged out to disk as well. However, there is a special type of memory that cannot be paged out to disk. One of the key items that reside in this space is the portion of the memory manager that handles virtual address translation and its related items and drivers for disk access. These items must remain resident in physical memory at all times.
Page Table Entries
As described in the previous section, the memory manager translates, tracks, and organizes real and virtual memory for applications and for portions of the kernel. Because of this, the memory manager must index where in real memory or where in a page file the data resides. When an application asks for the data, the memory manager can refer to the index to determine where that data actually resides and then retrieve it for the application. The following diagram shows a simplified explanation of the translation process.
Use of Page Table Entries
The Page Table, one of the internal tables used by the memory manager in translating virtual memory addresses to physical addresses, resides in the kernel’s memory space. The kernel’s allocated memory space (either 2 GB by default, or 1 GB with 4GT enabled) is divided into two sections, the Paged Pool area and the Page Table Area, as shown in the following figure.
Paged Pool and Page Table Areas
On a computer in the Windows Server 2003 family, the Page Table area, which contains the page table entries (PTEs), is 64 MB by default when 4GT is enabled. The Paged Pool space is approximately 256 MB. While these different allocations share the same memory area, the partition between them is fixed at startup. If the operating system runs out of space in either the PTE area or the Paged Pool area, the other area cannot donate space to it, and programs may begin to encounter unexpected errors. This can happen in certain scenarios when using 4GT. For more information about PTEs and 4GT, see “How 4GT Works.” By editing the registry, it is possible to limit the size of the Paged Pool space, which will then free additional memory for system PTEs.
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.
Physical Address Extension (PAE) X86
Physical Address Extension (PAE) X86 is another memory management technology that can, in certain scenarios, but used in conjunction with 4GT.
As described earlier in this section, the operating system, by default, can only address up to a total of 4 GB of physical memory. PAE X86 allows the operating system to access additional memory beyond 4 GB. This offers a direct benefit to the applications because more physical memory can be mapped into the application’s virtual address space.
Applications that are specifically designed and written to use additional physical memory can benefit from increased performance using PAE X86. Through the use of the Address Windowing Extensions (AWE) API set, the operating system can make the additional physical memory directly available to the application. This is particularly beneficial for large, data intensive application such as database management applications.
Applications not specifically designed to use the additional memory can also benefit from PAE X86 because the operating system uses the larger physical memory to reduce paging and thus increase performance. This is particularly beneficial on consolidation servers hosting multiple applications.
In many situations, it is valuable to use both 4GT and PAE X86. The combination of these two technologies maximizes the amount of physical memory available to applications. However, 4GT cannot be used with PAE X86 when the server has more than 16 GB of physical memory. In this situation, 4GT should be disabled and only PAE X86 should be used.
The following resource contains additional information that is relevant to this section.