32-bit Memory in x64 Windows

In the public 64-bit Windows newsgroup, we often get questions about memory usage, and a recent post there made me realize that there are some basic misunderstandings about the relationship between memory, virtual memory address space, and RAM. 

32-bit Windows uses a flat memory address space, thus is limited to 4 GB of memory addresses. This is divided up 2 GB for individual user programs, and 2 GB for the operating system. It doesn't matter if you have 4 GB of RAM, or 512 Mb of RAM, it's the same virtual memory address space. This means that in order to directly address the memory used by video cards, and other such things on your computer, the OS has to be assign those specific addresses to that memory, and it's locked away and can't be seen - effectively making your memory address space smaller. But each user program that runs gets its own 2 GB of virtual memory address space, regardless of the RAM in your machine. There are even programs that can access >2 GB of memory address space, IF you configure Windows to allow it - using the /3GB boot switch. This effectively limits the OS to only 1 GB of virtual memory address space for its own operations, however, causing the operating system to effectively starve if there's a lot of I/O or other demands on the OS itself, so it isn't recommended for ordinary usage. Especially since only specially written programs can take advantage of it.

Now, RAM. If you have 8 GB of RAM, running 32-bit Windows Vista, you simply can't see any of the RAM >4GB - there's no address space to communicate with it. So, if you have >4GB of RAM, you _need_ 64-bit Windows. (There is one exception to this, using something called /PAE, but it's not supported on all versions of 32-bit Windows and has a significant speed penalty, so is
generally not recommended.)

Whether a particular program that uses 1 GB of _memory_ will have all of the program in RAM is a decision that the operating system makes. It may decide to offload some of that to virtual memory, or may leave it all in RAM, depending on the other requirements of the system.

In 64-bit Windows, the memory address space is 16 TB. 8TB for user programs and 8TB for the operating system. 32-bit programs running in 64-bit Windows run in the WOW64 subsystem. Each 32-bit program is assigned a 4 GB virtual memory address space in the WOW64 subsystem - with no requirement for the OS which is still running in the 8 TB of virtual memory address space it gets.
So, if your 32-bit program is written to take advantage of >2GB of memory (using the LARGEMEMORYADDRESSAWARE compiler switch), it will automatically see a full 4GB.

 

Charlie.

Published Tue, Mar 18 2008 8:55 by Charlie Russel
Filed under: ,

Comments

Sunday, April 06, 2008 2:01 PM by Harlan

# re: 32-bit Memory in x64 Windows

Something is really messed up with my

configuration. I have a 64 bit X2 6000+

4gigs of ram, an GeForxe 8600 with 512

ddr3, and I cant  play halo 1 without running it in safe mode, I play Homm3 made in 98 and its choppy sometimes.  Is there a solution other

than wipe, reinstall?  

Sunday, April 06, 2008 3:42 PM by Charlie Russel

# re: 32-bit Memory in x64 Windows

I suggest you post in the public 64-bit newsgroup. microsoft.public.windows.64bit.general. That's the best venue for getting this kind of support.

# 4GB registering in 32bit Vista :) - Page 3 - Overclock.net - Overclocking.net

Pingback from  4GB registering in 32bit Vista :) - Page 3 - Overclock.net - Overclocking.net