Q: My system says the maximum is 4GB, so I’ve installed it BUT not all 4GB are showing up in Windows. Is there something wrong with the memory or my machine?
A: There is nothing wrong with the memory or the machine itself – 32-bit operating systems have a limit of 4GB, but that also includes where attached devices (e.g. sound card, video card, Ethernet, modem, etc.) are stored within Windows. In other words, the better the system you have, such as a higher end video card with a large amount of memory on-board, the less memory you’ll have access to from the 4GB.
Here is a good semi-technical article summing up the basics of what’s going on behind the scenes, which should help give you a clear idea of the situation.
Article is from CODING HORROR programming and human factors by Jeff Atwood — Content (c) 2007 Jeff Atwood.
Dude, Where’s My 4 Gigabytes of RAM?
Due to fallout from a recent computer catastrophe at work, I had the opportunity to salvage 2 GB of memory. I installed the memory in my work box, which brings it up to 4 gigabytes of RAM– 4,096 megabytes in total. But that’s not what I saw in System Information:
Only 3,454 megabytes. Dude, where’s my 4 gigabytes of RAM?
The screenshot itself provides a fairly obvious hint why this is happening: 32-bit Operating System. In any 32-bit operating system, the virtual address space is limited, by definition, to the size of a 32-bit value:
As far as 32-bit Vista is concerned, the world ends at 4,096 megabytes. That’s it. That’s all there is. No más.
Addressing more than 4 GB of memory is possible in a 32-bit operating system, but it takes nasty hardware hacks like 36-bit PAE extensions in the CPU, together with nasty software hacks like the AWE API. Unless the application is specifically coded to be take advantage of these hacks, it’s confined to 4 GB. Well, actually, it’s stuck with even less– 2 GB or 3 GB of virtual address space, at least on Windows.
OK, so we’re limited to 4,096 megabytes of virtual address space on a 32-bit operating system. Could be worse.* We could be back in 16-bit land, where the world ended at 64 kilobytes. Brr. I’m getting the shakes just thinking about segments, and pointers of the near and far variety. Let us never speak of this again.
But back to our mystery. Where, exactly, did the other 642 megabytes of my memory go? Raymond Chen provides this clue:
“In the absence of the /PAE switch, the Windows memory manager is limited to a 4 GB physical address space. Most of that address space is filled with RAM, but not all of it. Memory-mapped devices (such as your video card) will use some of that physical address space, as will the BIOS ROMs. After all the non-memory devices have had their say, there will be less than 4GB of address space available for RAM below the 4GB physical address boundary.”
Ian Griffiths offers a more detailed explanation:
“To address 4GB of memory you need 32 bits of address bus. (Assuming individual bytes are addressable.) This gives us a problem – the same problem that IBM faced when designing the original PC. You tend to want to have more than just memory in a computer – you need things like graphics cards and hard disks to be accessible to the computer in order for it to be able to use them. So just as the original PC had to carve up the 8086’s 1MB addressing range into memory (640K) and ‘other’ (384K), the same problem exists today if you want to fit memory and devices into a 32-bit address range: not all of the available 4GB of address space can be given over to memory.
For a long time this wasn’t a problem, because there was a whole 4GB of address space, so devices typically lurk up in the top 1GB of physical address space, leaving the bottom 3GB for memory. And 3GB should be enough for anyone, right?
So what actually happens if you go out and buy 4GB of memory for your PC? Well, it’s just like the DOS days – there’s a hole in your memory map for the IO. (Now it’s only 25% of the total address space, but it’s still a big hole.) So the bottom 3GB of your memory will be available, but there’s an issue with that last 1GB.”
And if you think devices can’t possibly need that much memory-mapped IO, I have some sobering news for you: by this summer, you’ll be able to buy video cards with 1 GB of video memory.
To be perfectly clear, this isn’t a Windows problem– it’s an x86 hardware problem. The memory hole is quite literally invisible to the CPU, no matter what 32-bit operating system you choose. The following diagram from Intel illustrates just where the memory hole is:
The proper solution to this whole conundrum is to use a 64-bit operating system. However, even with a 64-bit OS, you’ll still be at the mercy of your motherboard’s chipset and BIOS; make sure your motherboard supports using 4 GB or more of memory, as outlined in this MSKB article.
In case you’re wondering, the progression is giga, tera, peta, exa.
Although the performance benefits of 64-bit are somewhat dubious on the desktop, a 64-bit OS absolutely essential if you run applications that need to use more than 2 GB of memory. It’s not common, but we’re getting there.
The memory hole for IO still exists in the 64-bit world, but most modern BIOSes allow you to banish the IO memory hole (pdf) to some (for now) ridiculously high limit when you’re running a 64-bit OS. Don’t get too excited, though. The user-mode virtual address space in 64-bit Windows is a mere 8 terabytes. Suffice it to say that we won’t be running out of physical or virtual address space on 64-bit operating systems for the forseeable future. It’s the final solution, at least for the lifetime of everyone reading this blog post today.
Here’s one parting bit of advice: if, like me, you’re planning to stick with a 32-bit operating system for the next few years, don’t waste your money on 4 GB of RAM. You won’t be able to use it all. Buy 3 GB instead. Every motherboard I’m aware of will happily accept 2 x 1 GB and 2 x 512 MB DIMMs.
Posted by Jeff Atwood 144 blog reactions
“In any 32-bit operating system, the physical address space is limited, by definition, to the size of a 32-bit value. No… the /virtual/ address space is limited to 32 bits. It’s possible to have more /physical/ memory than this, and it’s even useful if you want to run more than one large process at a time. PDP-11s did this, AFAIR.
I don’t know enough about Windows or Intel architecture processors to know whether this is possible in that environment, though.
John on March 9, 2007 02:18 AM
“Do you need 4gigs of ram on a desktop machine though?
Well a few years ago I would have laughed at you but seeing how 2gigs actually makes a difference in Vista due to the improved memory management, I’d have consider going for it… If it didn’t mean I had to scrap my 4* 512 stick… But I guess even that’s off the table until people stop faffing around with 32bit desktop applications and decide they’re bored of it.”
Oli on March 9, 2007 02:25 AM
John: “you’re absolutely right. Corrected.
And the 36-bit PAE Intel extensions are what you’re thinking of, but they’re still a nasty hack. Far better to lace up your boots and go 64-bit now that AMD blazed the trail.”
Jeff Atwood on March 9, 2007 02:26 AM
Read more comments at CODING HORROR programming and human factors by Jeff Atwood — Content (c) 2007 Jeff Atwood.
You can also check this Microsoft support article (© 2007 Microsoft Corporation.) talking about this in regards to Windows Vista:
If a computer has 4 gigabytes (GB) of random-access memory (RAM) installed, the system memory that is reported in the System Information dialog box in Windows Vista is less than you expect. For example, the System Information dialog box may report 3,120 megabytes (MB) of system memory on a computer that has 4 GB of memory installed (4,096 MB).
Note You can access the System Information dialog box in the following ways:• Click Start, type System in the Search box, and then click System under Programs.
• Double-click System in Control Panel.
• Click Start, right-click Computer, and then click Properties.
• Click Show more details in the Windows Vista Welcome Center window.
This behavior is the expected result of certain hardware and software factors.
Various devices in a typical computer require memory-mapped access. This is known as memory-mapped I/O (MMIO). For the MMIO space to be available to 32-bit operating systems, the MMIO space must reside within the first 4 GB of address space.
For example, if you have a video card that has 256 MB of onboard memory, that memory must be mapped within the first 4 GB of address space. If 4 GB of system memory is already installed, part of that address space must be reserved by the graphics memory mapping. Graphics memory mapping overwrites a part of the system memory. These conditions reduce the total amount of system memory that is available to the operating system.
The reduction in available system memory depends on the devices that are installed in the computer. However, to avoid potential driver compatibility issues, the 32-bit versions of Windows Vista limit the total available memory to 3.12 GB. See the “More information” section for information about potential driver compatibility issues.
If a computer has many installed devices, the available memory may be reduced to 3 GB or less. However, the maximum memory available in 32-bit versions of Windows Vista is typically 3.12 GB.
Back to the top
For Windows Vista to use all 4 GB of memory on a computer that has 4 GB of memory installed, the computer must meet the following requirements:
• The chipset must support at least 8 GB of address space. Chipsets that have this capability include the following:
• Intel 975X
• Intel P965
• Intel 955X on Socket 775
• Chipsets that support AMD processors that use socket F, socket 940, socket 939, or socket AM2. These chipsets include any AMD socket and CPU combination in which the memory controller resides in the CPU.
• The CPU must support the x64 instruction set. The AMD64 CPU and the Intel EM64T CPU support this instruction set.
• The BIOS must support the memory remapping feature. The memory remapping feature allows for the segment of system memory that was previously overwritten by the Peripheral Component Interconnect (PCI) configuration space to be remapped above the 4 GB address line. This feature must be enabled in the BIOS configuration utility on the computer. View your computer product documentation for instructions that explain how to enable this feature. Many consumer-oriented computers may not support the memory remapping feature. No standard terminology is used in documentation or in BIOS configuration utilities for this feature. Therefore, you may have to read the descriptions of the various BIOS configuration settings that are available to determine whether any of the settings enable the memory remapping feature.
• An x64 (64-bit) version of Windows Vista must be used.
Contact the computer vendor to determine whether your computer meets these requirements.
Note When the physical RAM that is installed on a computer equals the address space that is supported by the chipset, the total system memory that is available to the operating system is always less than the physical RAM that is installed. For example, consider a computer that has an Intel 975X chipset that supports 8 GB of address space. If you install 8 GB of RAM, the system memory that is available to the operating system will be reduced by the PCI configuration requirements. In this scenario, PCI configuration requirements reduce the memory that is available to the operating system by an amount that is between approximately 200 MB and approximately 1 GB. The reduction depends on the configuration.
Read wkole Microsoft support article here. — © 2007 Microsoft Corporation.