Much of the information in this article was extracted from the Release Notes for the product.
This feature benefits applications that run on powerful computers with more than 2 GB of physical RAM and that can take advantage of a larger address space. The impact on developers and applications are summarized below.
Windows NT Server/E supports 4GT on Intel architecture servers only.
NOTE: The 4GT works only on 32-bit processors, so it does not increase the addressable memory of Windows NT Server beyond its current limit of 4 GB.
Writing Applications for 4GTUser-mode Address Selection:
When 4GT is enabled, the highest bit of a virtual address cannot be used to differentiate user-mode addresses from kernel-mode addresses.
Memory Allocation Issues:
Some dynamic link library (DLL) files load near the 2 GB boundary; therefore, there is a region of the 2 GB space in which contiguous memory cannot be allocated using VirtualAlloc.
Effects Visible in Kernel Mode:
Kernel-mode code can no longer assume the user/kernel boundary is at 0x80000000 or at any other number. Code that uses ProbeForRead or ProbeForWrite macros must be rebuilt using new headers that no longer contain assumptions about kernel space starting at 0x80000000.
Enabling 4GT Support in Your ApplicationsThe changes to support 4GT are done at both the system and application levels.
After you have installed Windows NT Server/E, you must modify the Boot.ini file to enable 4GT. To enable 4GT, simply add the /3GB parameter to the startup line.
NOTE: This change is only effective if you are using Windows NT Server/E. On standard Windows NT, this flag will relocate the kernel, but applications will be unable to access more than 2 GB.
[operating systems] multi(0)disk(0)rdisk(0)partition(2)\WINNT="Windows NT Server Version 4.00" /3GB
multi(0)disk(0)rdisk(0)partition(2)\WINNT="Windows NT Server Version 4.00 [VGA mode]" /basevideo /sos
No new APIs are required for 4GT support. Instead, memory allocations remain the same, with the exceptions that are noted below in "Tips for Effective 4GT Support." However, it would be ineffective for every application to automatically be provided with a 3-GB address space. To provide a selective use of 4GT, the following mechanism has been implemented:
- Executables that must see the 3-GB address space are required to have the bit IMAGE_FILE_LARGE_ADDRESS_AWARE set in their image header. This can be done using the Imagecfg tool that is included in the Support folder on the Windows NT Server/E compact disc. For example, to modify the target file DBMSApp.exe, type the following at a command prompt:Imagecfg -l DBMSApp.exe
Tips for Effective 4GT SupportThe following guidelines are intended as a summary of changes that developers will want to review when they consider enabling 4GT support within their applications:
- Use GlobalMemoryStatus to get the amount of total user virtual space. Avoid using hard-wired constant definitions such as "#define HIGHEST_USER_ADDRESS 0xC0000000". Try to detect the real value at runtime.
- Avoid signed comparisons with pointers. Some applications might crash on a 4GT-enabled system for just this reason. A condition such as "if (pointer > 40000000)" will be false for a pointer that is above 2 GB.
- Code using the highest bit to tag items (data value versus an address value) will fail. For example, a 32-bit word might be considered a user- mode address if below 0x80000000 and an error code if above. This does not work anymore.
Setting a Paging File SizeIf you are using the 4GT option and have a system with greater than 3 GB of physical memory, you may want to consider changing the default size of your page file. Note that this is changed by using the System tool in Control Panel. In Windows NT 3.51, the default pagefile size is generally 11 MB larger than physical memory. In Windows NT 4.0, the default pagefile size is equal to the amount of physical memory on the system. On a 4-GB computer, this would result in a 4.01-GB paging file. Under such circumstances, the effectiveness of this paging file could be minimal, based on the total size, which is 4 GB. Accordingly, a 256-MB page file could be a more effective use of disk space. However, having a smaller paging size will affect the total memory commit size for applications. You should review these settings with the Independent Software Vendor (ISV) for your applications that are being run with the 4GT option.
รหัสบทความ: 171793 - การตรวจสอบครั้งสุดท้าย: 31 ต.ค. 2006 - ฉบับแก้ไข: 1