Contents
Sponsored Feature: RAM, VRAM, and More RAM: 64-Bit Gaming Is Here
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [11]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [12]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Sucker Punch Productions
Texture Artist
 
Sucker Punch Productions
3D Environment Artist
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Character Artist
 
Sony Online Entertainment
Brand Manager
 
Monolith Productions
Sr. Software Engineer, Engine - Monolith Productions - #113767
 
Crystal Dynamics
Sr. Level Designer
 
Gargantuan Studios
Technical Art Director
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [6]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [7]
 
arrow iPhone Piracy: The Inside Story [48]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Time Fcuk
 
Accepting the Inherent Value of Games
 
Planckogenesis, Part II: Song Structure & Gravy Train [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  Sponsored Feature: RAM, VRAM, and More RAM: 64-Bit Gaming Is Here
by Chuck Walbourn
3 comments
Share RSS
 
 
April 4, 2008 Article Start Previous Page 2 of 6 Next
 

The 2GB Limit: Virtual Memory Limitations

So far we’ve been talking about the limits of memory with respect to the system as a whole. However, a 32-bit processor also means the applications running on it are themselves 32-bit programs. Modern operating systems like Windows use virtual memory to enforce security and stability between running programs. As part of this implementation, the top half of the virtual address space is reserved for use by the operating system itself. This means standard 32-bit programs are limited to using half of the potential virtual address space:

231 = 2,147,483,648 bytes or 2 GB

Advertisement

The other half of the address space is used by the operating system kernel as privileged shared memory areas to allow fast switching to kernel mode without needing to reload memory mappings. This has some important and useful properties for programs. For example, the difference between any two memory locations allocated by the program is guaranteed to fit into a 32-bit signed number without under- or overflow (i.e., Standard C++ ptrdiff_t would not work in all cases for 32-bit programs if they had a full 4 GB address space).

Virtual address space is also used for more than just accessing physical memory. It is used for communication with hardware devices such as the graphics AGP/PCIe aperture, and for memory-mapped file I/O. When the typical PC had 512 MB or one GB of physical RAM, there was still plenty of room in the 2 GB of virtual address space for all these uses in most cases.

As memories got larger, 2 GB of virtual address space became a limiting factor. This was the case for data-intensive database and server applications when their files grew beyond a few MBs into multi-GBs or even Terabytes in size. Microsoft extended the Win32 API with the Address Windowing Extensions5 to enable applications to take advantage of the extra physical RAM made possible by 36-bit mode PAE.

Unfortunately, this could be enabled only under special circumstances. AWE enables a 32-bit application to use more than 2 GB of RAM by using the classic technique of “windowing,” but windowing doesn’t get around the fundamental limitations of the system. Because it is complex, windowing is difficult to manage and the extra memory areas cannot be paged to disk.

A more direct proposal was to give back the 32nd bit to applications. In principle, the concept is fairly simple: a 32-bit application is linked with the Large Address Aware flag (/LARGEADDRESSAWARE) to indicate it will work correctly if it is given memory addresses larger than 2 GB. Since all pointers in the application are already 32 bits, this is a simple condition to meet, assuming the program does not:

  1. Use pointer arithmetic that can result in the difference failing to fit into a 32-bit signed integer, or make other assumptions that pointers are always less than 2 GB in size.

  2. Override the meaning of the 32nd bit for other purposes, such as indicating a “handle” vs. a “pointer” (this technique is used by the DirectX SDK’s D3DX9 Effects library by default with the D3DXHANDLE type).

The real limitation of Large Address Aware (LAA) is that the operating system configuration has to support it. Standard Windows configurations assume the kernel has 2 GB of address space to work with. Special boot modes are required to constrain the kernel to less than that in order to allow LAA applications to have more than 2 GB of user address space. This is accomplished by the use of the /3GB switch or the /userva switch in Windows XP, or the IncreaseUserVa Boot Configuration Database element in Windows Vista.6

This will reserve up to 3 GB of address space for LAA applications, leaving the kernel with only 1 GB. Many combinations of drivers and software loads can result in out-of-memory conditions for the kernel in this constrained memory boot mode. It is a difficult solution to implement for your average gamer, and is better left for technically savvy IT managers to deploy in special circumstances. Again, this helps with the virtual address space limitations of 32-bit programs, but doesn’t get around the physical RAM limitations.


5 “Address Windowing Extensions,” Microsoft Corp, MSDN Library.

6 “4-Gigabyte Tuning,” Microsoft Corporation, MSDN Library.

 
Article Start Previous Page 2 of 6 Next
 
Comments

Klaus Post
profile image
Anandtech has also a very good writeup on LAA in relation to current games on 32 bit systems.

Part 1 - Practical Problems With 32bit Addressing In Windows (description and test of current games without LAA boot)
http://www.anandtech.com/gadgets/showdoc.aspx?i=3034

Part 2 - Windows XP, Vista, and the 2GB Barrier: (Comparison of Vista/XP virtual memory usage of games)
http://www.anandtech.com/cpuchipsets/showdoc.aspx?i=3044

Part 3 - Vista Buys Some Time: (Testing the KB940105 Hotfix)
http://www.anandtech.com/systems/showdoc.aspx?i=3060

Ondrej Spanel
profile image
"In fact, this incident proves that many modern AAA PC titles are already within 256 MB of the 2 GB barrier. Otherwise, they would not have hit this problem until video cards were over 512 MB."

This is not entirely true, depending on what metrics you use for the "distance from the barrier". Part of the problem is memory fragmentation, and the position of the "hole" created by the allocation differs depending on its size.

The game will usually "hit the 2GB barrier" way before it uses 2 GB of virtual space.

Chuck Walbourn
profile image
It is true that virtual memory fragmentation can lead to hitting the barrier early, and in fact we saw titles doing this several years ago. You'll note it is listed in "Top Issues for Windows Titles" in the DirectX SDK technical article, which was published in 2006.

The first mitigation effort for all the titles hitting this problem was to reduce vm fragmentation. Glaring problems are easy to fix, but games have been dealing with this concern for a while. Many AAA titles with full content are very close to filling up the 2 GB of VAS available to standard 32-bit apps. While KB9410105 brings the memory usage inline with XPDM to eliminate the Windows XP vs. Windows Vista differences, it doesn't change the fact that games are wanting to include more and more content.


none
 
Comment:
 


Submit Comment