You are on page 1of 9

4GT Technical Reference

Updated: March 28, 2003 Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

4GT Technical Reference


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 32-bit versions of the Microsoft Windows Server 2003, Enterprise Edition, or Windows Server 2003, Datacenter Edition, operating systems to use 50 percent more virtual memory by making less virtual memory available to the operating system. This subject will provide an overview of 4GT along with an in-depth description of how 4GT works. Note

4GT is not required on the 64-bit versions of the Windows Server 2003 family.

In this subject

What Is 4GT? How 4GT Works 4GT Tools and Settings

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

Common 4GT Scenarios Technologies Related to 4GT Related Information

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 computers 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.

Note

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. Memory Manager 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 applications 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 systems 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 kernels memory space. The kernels 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. Note

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 applications 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.

Related Information
The following resource contains additional information that is relevant to this section.

PAE X86 Technical Reference

How 4GT Works


Updated: March 28, 2003 Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

How 4GT Works


In this section

4GT Architecture 4GT Processes and Interactions

The technology called 4-gigabyte tuning (4GT) is a scale up component in the Windows Server 2003 family. The Microsoft operating environment delivers scalability via two methods: scale up and scale out. Scaling up refers to running a single application or image on a single server and having the ability to incrementally add system hardware resources (processors and memory) to increase overall system performance. Scaling out refers to distributing the computing workload among multiple servers with the ability to add or subtract servers to increase or decrease capacity. Enterprises are required to scale flexibly to respond to spikes in business and to support the rapid roll out of new products and services. It is therefore increasingly important that an organizations computing infrastructure provides the ability to increase or decrease computing capacity almost instantly, while continuing to deliver value. 4GT helps provide this scalability. There are few restrictions regarding the environment in which 4GT can be enabled. 4GT has the following hardware and software requirements:

x86-based processor 2 gigabytes (GB) or more of RAM Windows Server 2003, Enterprise Edition, or Windows Server 2003, Datacenter Edition Windows Server 2003, Standard Edition, but only in non-production environments.

4GT should not be used if either of the following is true:

Greater than 16 GB of physical memory are available and Physical Address Extension (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.

Note

4GT is not required on the 64-bit versions of the Windows Server 2003 family.

4GT Architecture
4GT alters the way the memory manager allocates the virtual address space available on the computer. The following diagram and corresponding table illustrate this process. 4GT Architecture

When virtual memory space is requested by the user mode applications or the kernel, the memory manager determines where that memory will physically reside. The virtual address to physical address translation information is kept in the page table, which is part of the kernels virtual address space. Using this translation data, the memory manager accesses the data The following table describes the components related to the 4GT architecture. Components of the 4GT Architecture

Component Kernel or User Application Memory Manager 4 GB Virtual Address Space

Description The user mode application or kernel process that requests data at a specific virtual address space. Operating system component that allocates, organizes, and tracks memory assignments. Virtual addresses representing the 4 GB of RAM that is recognized by default by the operating system. Using 4GT, this 4 GB is divided to give user mode applications 3 GB of virtual address space and the kernel 1 GB of virtual address space. The kernels 1 GB is further allocated into many other specific sections, including the page table area. A portion of the kernels virtual address space that indexes virtual memory addresses to physical addresses.

Page Table

Paging File RAM

The files on a hard disk where data is stored instead of storing that data in RAM. The physical RAM where data is stored.

4GT Processes and Interactions


4GT is not enabled by default. In order to enable 4GT, the /3GB switch must be added to the servers Boot.ini file. The addition of this option causes the operating system to change the default virtual address allocations for applications and the kernel. Upon starting an application, the operating system examines the header file for that application. If the application header includes the IMAGE_FILE_LARGE_ADDRESS_AWARE flag and the /3GB switch has been used to enable 4GT, then the application has access to the greater virtual address space. Instead of dividing the available 4 GB of virtual memory evenly between the kernel and any specific user mode application, 4GT provides less virtual address space to the kernel. This results in 3 GB of virtual memory to be allocated to the application. With 4GT, the virtual addresses available to the application range from 0x00000000 through 0XBFFFFFF. This is an increase of the default range of 0x00000000 through 0x7FFFFFFF. The virtual memory address range for the kernel shrinks from 0x80000000 through 0xFFFFFFFF to 0xC0000000 through 0xFFFFFFFF, as shown in the following diagram. Virtual Memory Allocation

4GT can be used with Windows Server 2003, Enterprise Edition, or Windows Server 2003, Datacenter Edition. In addition, 4GT can be used with Windows Server 2003, Standard Edition, but only in nonproduction environments. The /Userva Parameter In some cases, restricting the kernel to only 1 GB of memory might not be desirable, but the kernel might not need 2 GB either. In order to further refine memory management options, a new parameter, /Userva, has been introduced in Windows Server 2003, Standard Edition; Windows Server 2003, Enterprise Edition; and Windows Server 2003, Datacenter Edition. This parameter can only be used in conjunction with the /3GB switch. The /Userva parameter allows an administrator to determine the specific size of the user mode virtual address space between 2 GB and 3 GB. The value specified by the /Userva parameter in the Boot.ini files (expressed in MB) determines the amount of memory the memory manager will return to the kernel. The amount of memory returned is 3072 MB less the value specified by the /Userva parameter. For example, to increase the kernels memory space by 172 MB, the following parameter combination would be used in the Boot.ini file: 3GB /Userva=2900 This additional kernel address space is held in reserve and used as additional address space for Page Table Entries (PTEs) in the event that the system runs out of free PTE space. This address space is not allocated to PTEs until the system runs low on PTE space. For more information about PTEs, see Page Table Entries later in this section.

Page File Page files store data that cannot be kept in RAM. The default page file size is equal to 1.5 times the amount of physical memory on the system. On a 4 GB computer, this can result in a page file larger than 4 GB. Under such circumstances, the effectiveness of this large of page file could be minimal, based on the usage of the system, such as when hosting database management applications. However, there are also times when even larger page files are needed, such as when multiple applications are consolidated on to one system. Therefore, on servers with 4 GB or more of memory, it is often preferable to change the default size of the page file based on the usage of the server. Regardless, on x86-based computers with 4 GB or more of physical memory there should be a page file sufficiently large to capture a kernel memory dump. A page file size of at least 2,050 MB is the minimum size necessary for computers with 4 GB or more of physical memory to capture a complete kernel memory dump. The page file can be much larger (up to three times the physical RAM is typical) if the system is being used for application consolidation. Page Table Entries The page table is used by the memory manager to track the physical location of the page files. When using 4GT, because of the smaller amount of virtual memory allocated to the kernel, the number of Page Table Entries (PTEs) that can be recorded by the memory manager in the page table is also significantly reduced. In a standard configuration (without 4GT), there are typically 80,000 to 140,000 PTEs available. This is reduced to only 40,000 PTEs when using 4GT. This can lead to problems when the amount of physical memory increases and the kernel is required to keep track of larger and larger amounts of PTEs. 4GT and PAE X86 PAE X86 is another technology that allows access to additional physical memory. 4GT and PAE X86 can be combined to provide applications large amounts of virtual memory and provide a significant performance boost. However, using 4GT reduces the amount of PTE space available to the kernel, while using PAE X86 dramatically increases the amount of memory that must be indexed and translated by the memory manager. Thus this combination will exhaust system kernel space much earlier than normal. Because of this, the memory manager imposes a virtual memory limit of 16 GB on a system with both 4GT and PAE X86 enabled. Even if a system has 32 GB or more of physical memory, if both options are enabled, only 16 GB of memory will be recognized. Note

Even though the memory manager imposes a hard limit of 16 GB when both 4GT and PAE X86 are enabled, it is possible to encounter problems with lesser amount of memory, such as 8 GB or 12 GB. Therefore, the kernel should be given as much memory as possible.

4GT Tools and Settings


Updated: March 28, 2003 Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

4GT Tools and Settings


In this section

4GT Registry Entry Related Information

The following section describes one registry entry associated with 4-gigabyte tuning (4GT). Note

4GT is not required on the 64-bit versions of the Windows Server 2003 family.

4GT Registry Entry


The following registry entry is associated with 4GT. The information here is provided as a reference for use in troubleshooting or verifying that the required settings are applied. It is recommended that you do not directly edit the registry unless there is no other alternative. Modifications to the registry are not validated by the registry editor or by Windows before they are applied, and as a result, incorrect values can be stored. This can result in unrecoverable errors in the system. When possible, use Group Policy or other Windows tools, such as Microsoft Management Console (MMC), to accomplish tasks rather than editing the registry directly. If you must edit the registry, use extreme caution. PagedPoolSize Registry path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\ Version Windows Server 2003, Enterprise Edition, and Windows Server 2003, Datacenter Edition This registry key determines the number of bytes allocated to the paged pool. It can be reduced in order to provide additional space for Paged Table Entries (PTEs). Because some computers require a certain amount of paged pool area size, reducing this value will not be an option in all cases. You should not typically need to change this registry value. The operating system calculates an optimal value for this entry based on the amount of physical memory on the computer. Note

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.

Related Information
The following resources contain additional information that is relevant to this section.

How 4GT Works Registry Reference in Tools and Settings Collection

You might also like