Log in

View Full Version : Windows Memory Considerations



Maz
05-01-2008, 08:28 AM
As I've expanded this post beyond its original intent, I've renamed it. This thread was originally called "Windows XP 3GB limit"

I found a good explanation of the cap placed on physical memory by 32 bit versions of Windows XP here ('http://members.cox.net/slatteryt/RAM.html').

Pertinent quotes:

The physical address space is used to address more than just RAM. It is also used to address all of the memory and some of the registers presented by devices. Consequently, if a machine is configured with the maximum amount of physical memory, some of that memory will be unusable because some of the physical address space is mapped for other uses.

Video cards nowadays commonly have one or two hundred MB of RAM on them. That video RAM takes up part of the 4GB address space, which then is not available for your physical RAM.

The /3GB switch in the boot.ini file affects the way Windows XP allocates the 32-bit virtual address space that each process gets. By default, that address space is split evenly between the operating system and the program. The /3GB switch forces the OS to allocate 3GB to the program and only 1GB to the system. This can result in the OS being squeezed and not working efficiently. It's necessary for only a very few, extremely RAM-hungry programs. It will not make your missing physical RAM reappear.
I was a little confused by this part:

The Microsoft document referenced above says that 32-bit Windows XP allows 128GB of RAM. That's 37 bits of address space.
But reading the Microsoft document clarifies things a little:

Current x86 CPUs use 32, 36, or 40 bits for physical addresses in the modes that Windows supports, although the chipsets that are attached to some 40-bit processors limit the sizes to fewer bits. Current releases of 32-bit Windows support a maximum of 37 bits of physical address for use as general-purpose RAM (more may be used for I/O space RAM), for a maximum physical address space of 128 GB. (These values may increase in the future.) Windows also continues to support older processors that decode only 32 bits of physical address (and thus can address a maximum of 4 GB).
A processor that uses full 64-bit virtual addresses can theoretically address 16 exabytes. (An exabyte is a billion gigabytes, and a terabyte is a thousand gigabytes.) Current releases of 64-bit Windows support from 40 to 50 address bits and 128 GB to 1 terabyte of RAM, depending on the specific edition of the operating system.
There's an article examining the benefits and drawbacks of running 64 bit versions of Windows here ('http://www.tomshardware.com/reviews/vista-workshop,1775.html').

Pertinent quotes:

The upshot is that it doesn't make sense to install a 64 bit version of Vista in order to better utilise 4GB of memory simply because the 32 bit version would only recognise 3.5GB. The problem is that while it is true that you would "gain" the missing memory, you would also immediately lose it to the system due to the 64 bit version's larger memory footprint. Thus, using a 64 bit version really only makes sense with larger memory sizes.
So to sum up:
Windows XP 32 bit can access a 4GB physical address space.
This physical address space is reduced by memory needed for the system ROM and devices including PCI and PCIe cards.
The resultant memory size represents how much of your physical memory is available to the OS.
Each 32 bit process has a 32 bit virtual address space. This is split so that 2GB is allocated to application code and 2GB to the operating system.
The /3GB switch adjusts this balance and is only worthwhile for very memory hungry applications.
The /3GB switch may harm performance by limiting the virtual memory space available to the OS.
The /3GB switch will not free up any more of your physical memory.

Regarding 64 bit Operating Systems:

64 bit versions of WIndows have access to a larger physical address space.
32 bit applications run under a subsystem called Windows-on-Windows 64 ('http://en.wikipedia.org/wiki/WOW64').
32 bit applications running under WOW64 still only have a 32 bit virtual address space.
Unless you have greater than 4GB of physical memory, moving to a 64 bit version of Windows will not benefit you (at least in terms of physical memory utilisation).

Bollwerk
05-01-2008, 06:23 PM
It may be worth noting that if you have 4GB, you won't get any better results with 64-bit Vista vs 32-bit XP, since Vista is more of a memory hog. Of course, you may still want to use 64-bit Vista for future expandability, DX10, better multi-monitor support, etc.

Djarid
05-02-2008, 04:03 AM
Further Clarification.

Vista's Memory Usage
Most of the perceived bloatedness of Vista is due to prefetch, a service implemented to speed up the launch of commonly used programs. If you use a single directory for your wow installs, this loads one copy of the MPQ files into memory (other wise it loads them for each directory)

User vs System Memory
As has been mentioned, this can be detrimental to performance. If one application is running which has a heavy user mode foot print then /3Gb can improve performance but in the case of 5 boxing on a single computer, you have 5 processes wanting ~300mb each, /3Gb will just reduce the amount of system mode memory available for them all and could easily impact performance.

Memory (32bit vs 64bit)
64Bit OS require 64bit drivers and run 64bit processes. Apparently (and I am fuzzy on this one), as these use 64bit addressing, twice as much memory is used to store the same value (8 bytes treated as a single unit instead of 4 bytes). This means that the OS on 64bit will reserve more memory than the OS on 32bit.

So it seems that if you have less than 3.2Gb available in 32bit windows then you will probably benefit from the upgrade, by how much will remain to be seen

WOW Process (32bit vs 64bit)
World of Warcraft is a 32bit application, as such, when running on an 64bit OS it must run inside a wow64 (Windows on Windows) this is a 32bit emulation layer and has its own overhead. Anyone familiar with NT4 will remember the original WOW and NTVDM (Virtual Dos mode) to allow 16bit applications to run in a 32bit environment. The overhead on these is not quite as large as the WOW\VDM pairing as only one emulation layer is required. Also remember that a 32bit app has the 32bit OS limitation as far as memory addressing goes (2Mb user mode and 2mb system).

SUMMARY
So if you have 4Gb physical and 3.2Gb+ RAM available in your 32bit OS don't go 64bit as you will be unlikely to benefit from increased RAM and each WOW session will have the wow64 overhead (this is shared across all applications running within the same wow64 instance)

Sam DeathWalker
05-02-2008, 12:27 PM
Right with 4G Vista gets you little or nothing. Out of the 4G you will get like 3.2 showing in taskmanager as the video ram also takes up address space.

I get 3.6G with win2K cause I use a motherboard with .5G "vista ready boost flash ram".

Its this board cept with the ready boost feature, guess they don't even make them anymore lolzors:

http://usa.asus.com/products.aspx?l1=3&l2=101&l3=300&l4=0&model=1163&modelmenu=1

On my non main computers I just went to 3 gig and see the same 2.6G in taskmanager that I see with 4G ...

BobGnarly
05-02-2008, 06:47 PM
32 bit applications run under a subsystem called Windows-on-Windows 64 ('http://en.wikipedia.org/wiki/WOW64').
32 bit applications running under WOW64 still only have a 32 bit virtual address space.



Further Clarification.

WOW Process (32bit vs 64bit)
World of Warcraft is a 32bit application, as such, when running on an 64bit OS it must run inside a wow64 (Windows on Windows) this is a 32bit emulation layer and has its own overhead. Anyone familiar with NT4 will remember the original WOW and NTVDM (Virtual Dos mode) to allow 16bit applications to run in a 32bit environment. The overhead on these is not quite as large as the WOW\VDM pairing as only one emulation layer is required. Also remember that a 32bit app has the 32bit OS limitation as far as memory addressing goes (2Mb user mode and 2mb system).


So I'm a little confused. Are we saying that ALL 32-bit applications share one wowo64, and hence 4g-X RAM, or that each wow can get its own wow64, and so EACH ONE gets 4g-X memory?

Maz
05-02-2008, 06:52 PM
Each 32 bit process gets it's own 32 bit (4GB) virtual address space.

The 4GB-X relates to the physical memory.

The virtual address space is split up into pages. These pages are mapped to either physical memory or virtual memory on disk. If a process tries to access a memory page that has been swapped out to disk, the process pauses while that memory is loaded in (and possibly some other page is stored out).

So although each 32 bit process can access a total of 4GB of memory, that memory won't all be physical memory, some of it will be virtual memory. So you have lots of processes each with a 4GB address space all running in a machine that has less than 4GB of physical memory.

Edit: It occurs to me that I've diverted myself into irrelevant minutiae. Suffice it to say that:

The /3GB switch will not liberate any of your physical memory and may harm performance.
Moving to 64 bit will not help unless you have more than 4GB of physical memory.

Djarid
05-03-2008, 05:08 PM
Maz,

Is it fixed that has each 32bit process launch their own wow64 or can you configure applications to share a wow?

I am going from the ld NT days were all 16 bit apps would run in a single NTVDM unless configured to launch their own.

Maz
05-16-2008, 07:47 AM
Sorry Djarid but I really don't know.

Here's ('http://blogs.msdn.com/craigmcmurtry/archive/2004/12/14/301155.aspx') another article about it though.