The 32bit 4GB barrier demystified (as much as possible) with pics

gamerman4

Active Member
Why your 4GB of RAM is showing up as less than 4GB

Alright before anything you must understand the difference between memory capacity and addressing space.
When something is read from your memory, your computer finds what it needs in the addressing space, it is kindof like an IP address, it represents something in the virtual world. The addressing space is limited by the bit depth of your memory controller, which in most modern systems is actually better than 32-bit, (128 bit i think, please correct me if I'm wrong). The limitation here goes from your memory controller to your OS. If the motherboard memory controller were 32-bit, a 64-bit OS would be limited as well. A 32-bit OS can only register a 32-bit address space which it uses to address places in your RAM and also addresses your system components. According to your OS, RAM is just another component to be addressed and it just addresses everything in the same pool which is why 4GB of RAM is limited by the devices in your computer.

Alright we all know that a 32bit addressing space is roughly 4GB
here is the simple math to prove that.
a single bit will either be 1 or 0 so thats 2 possible numbers per bit
2^32 = 4,294,967,296
There is the theoretical maximum size of a 32-bit addressing space
Which means the theoretical maximum for 64-bit is
2^64 = 18,446,744,073,709,551,616 bytes or 18.4 Exabytes.....theoretically

You may have noticed Windows doesn't have all 4GB available, this is because all hardware takes up places in the addressing space. Just so you know, Windows really knows that you have 4GB RAM, it also knows you can't use it all because of this limitation. Windows 7 will actually tell you this:
Capture-1.jpg


Resource Monitor tells you how much space your hardware takes up:
resmon.jpg


Now we know it tells us that hardware is taking up address space but how do we figure out which components are using up the most space?
easy, Device Manager...

Here is my graphics card as an example of how hardware takes up address space...
mem1.jpg

scroll down and some more...
mem2.jpg


so my gfx card is using these memory addressing spaces:
FD000000 - FDFFFFFF
D0000000 - DFFFFFFF
FA000000 - FBFFFFFF
000A0000 - 000BFFFF


well that doesn't look right, what are those letters, well that is called hexadecimal which is just a numbering system that uses a base of 16 rather than the traditional 10 we are all used to.
so....since the highest number in hex is F lets check out what the highest possible number in the memory range is, which is FFFFFFFF
FFFFFFFF = (hex >> decimal) = 4,294,967,295
look familiar?
so how much of the addressing space is my gfx card using?

FDFFFFFF - (minus, not dash) FD000000 = 16,777,215
DFFFFFFF - D0000000 = 268,435,455
FAFFFFFF - FA000000 = 16,777,215
000BFFFF - 000A0000 = 131,071
for a total of - 302,120,956 bytes, roughly 289MB of addressing space
as a side note, understand that just because my gfx card has 512MB VRAM, it doesn't mean that it will be a 1:1 mapping in the address space, as you can see by this.

A possible explanation to the non-1:1 mapping of VRAM:
The computer accesses the vram through a base address register which is what is used to address the space. Due to hardware limitations the base address register does not encompass the entire amount of available vram. Essentially the CPU can only directly access a smaller portion of available VRAM but graphics cards have their own memory controller so it has direct access to its own memory, the entire lot of it so it gives the CPU what it needs to access and what is left is mapped only by the graphics cards. Programmers use methods such as "windowing" to access the physical memory that isn't actually in the computers virtual address space.


Disclaimer:
I do not see myself as an expert in this, these are just my observations. If you see anything wrong just let me know. I purposefully did not go into technical details for the fact that they really aren't necessary to understand this phenomenon.




Also, if a mod has the ability to change thread titles, I think it should say 4GB RAM barrier
 
Last edited:

bomberboysk

Active Member
Should add that other things such as pci cards, sound cards, lan controllers, cpu cache, etc can also take up adressing space, not only just gfx cards.
 

Ethan3.14159

Active Member
This should definitely be a sticky. I see threads on this all of the time. This would certainly help out those who are confused. Good work :)
 

bomberboysk

Active Member
but they all work that same as far as Windows is concerned, it would just get redundant.

Im not saying to show images of all those and how much address space they use, i was just saying that in the guide you mentioned gfx cards, but i was suggessting you add something such as"Other devices such as usb peripherals, cpu cache, hard drives, pci cards, etc can also reduce avaiable adress space." or something along those lines;)
 

raoul_1101

Member
I have a question then..
If the mapping of your video card memory is not 1:1, where is the rest mapped? Is it like, the rest of that memory is not viable by the CPU and only the GPU? Because it's definitely not mapped to I/O_Memory?
 

gamerman4

Active Member
I have a question then..
If the mapping of your video card memory is not 1:1, where is the rest mapped? Is it like, the rest of that memory is not viable by the CPU and only the GPU? Because it's definitely not mapped to I/O_Memory?

I can barely find any information about that but here is the culmination of what I have found.

The computer accesses the vram through a base address register which is what is used to address the space. Due to hardware limitations the base address register does not encompass the entire amount of available vram. Essentially the CPU can only directly access a smaller portion of available VRAM but graphics cards have their own memory controller so it has direct access to all of its own memory so it gives the CPU what it needs to access and what is left is mapped by the graphics cards. Programmers use methods such as "windowing" to access the physical memory that isn't actually in the virtual address space.

Source:
http://download.intel.com/technology/pciexpress/devnet/docs/PCIe3_Accelerator-Features_WP.pdf

http://en.wikipedia.org/wiki/Address_Windowing_Extensions
 
Last edited:

Mitch?

banned
looks nice bro! should clear a bit up for people who haven't already gotten annoyed with everyone's posts and looked into it alot :p
 
Top