Sign in with
Sign up | Sign in
Your question

32/64-bit Explained

Tags:
Last response: in Memory
Share
April 6, 2009 1:34:29 PM

I've seen this pop up enough where I feel a definitive faq needs to be made. I don't profess to be much of a teacher, but I'll try to explain this as simply as I can.


When we refer to "32-bit" or "64-bit" we are referring to the number of consecutive 0/1 values that a current computer configuration can understand. A 32-bit value would consist of 32 consecutive 0/1 values, and a 64-bit value would contain 64. A string of these values can represent a memory location or an Integer value, depending on context.

For CPU compatability, the CPU must contain a register set that can contain these values unbroken, with a few special exceptions. So a 32-bit CPU would contain at least (usually more) one register that can hold a 32-bit value, and a 64-bit CPU would contain a register than can hold a 64-bit value.

The OS, while not limited by the number of bits, does require a System Address Space (SAS). As explained by Microsoft:

Quote:
The virtual address space for a process is the set of virtual memory addresses that it can use. The address space for each process is private and cannot be accessed by other processes unless it is shared.

A virtual address does not represent the actual physical location of an object in memory; instead, the system maintains a page table for each process, which is an internal data structure used to translate virtual addresses into their corresponding physical addresses. Each time a thread references an address, the system translates the virtual address to a physical address.


A 32-bit system can address exactly 4,294,967,295 bits (2^32 or 4GB), which is the size of the SAS. If at this point there is more hardware that requires an address, the OS will have to decide which devices get priority. Typically, the main memory gets whatever address space remains after all the other devices have been given addresses, although this varies depending on the OS. Any leftover memory will go unused, as there is no way to represent the memory location as a 32-bit string of 0/1 values (11111111111111111111111111111111 in Binary = 4,294,967,295, expressing 4,294,967,296 or higher is impossible).

Hence, why a 32-bit OS will typically show less main memory then is avaliable for use. Since the OS will use a 32-bit address space, any hardware that requires have address space will eat into the maximum avaliable amount of main memory. The easiest way to find the maximum avaliable for use is to use the following formula:

Main Memory = 4GB - 256MB - GFX card RAM - Other Devices

Assuming a 1GB Graphics card and no other devices that require address space, you get (4GB - 256MB - 1GB = 2.75GB RAM). Note, the 256MB is typically lost due to various low level Motherboard devices (PCI/PCI-E Bus, ect.), and can vary greatly depending on the motherboard.

It should also be noted, Windows uses its System Address Space slightly diffrently then other 32-bit OS's:

Quote:
The virtual address space for 32-bit Windows is 4 gigabytes (GB) in size and divided into two partitions: one for use by the process and the other reserved for use by the system.


As such, while 32-bit Windows may be able to address up to 4GB, an individual process can only use up to 2GB of that space, regardless of how much remains free for use. Using the /3GB switch can increase the amount of RAM avaliable to applications, but does not increase the size of the System Address Space, and will not increase the maximum amount of RAM usable by the system.


Note, that the number of bits avaliable does affect more then just memory addressing. The range of integer values, for example, is determined by the amount of bits avaliable. As the maximum number that can be expressed in binary for a 32-bit value is 4,294,967,295, the range of signed integer values that can be understood ranges from -2,147,483,647 to 2,147,483,647. You can test this in a compiler by setting an Int32 value to above or below this threashold. (Do not use a plain int declarator, as this may cause a 64-bit Integer to be declared instead).

Now, larger values can be used. This is done by storing the value in two seperate 32-bit registers (essentally, cutting the address in half). This comes at a performance hit however, as two seperate LOAD instructions and an ADD instruction need to be performed to get the same exact value. In the best possible case, getting a 64-bit Integer on a 32-Bit system requires twice as many instructions as a 64-bit OS would require. This becomes vital for mathematical formula dealing with exponential values, as well as most rendering applaications.

The above method can also be used to artifically extend the System Address Space. However, this does cause a performance hit, as well as difficulty with most drivers, and is not typically used.


I hope I did a decent job explaining how a 32/64-bit OS works. If there are any comments/corrections, please post below.

More about : bit explained

a b } Memory
April 6, 2009 2:08:59 PM

I believe you have /3GB and /PAE confused.



By default, Windows reserves 2GB worth of address space for system usage, and the other two is application space. What the /3GB switch does is alter those vaules from {2 System and 2 App} to to {1 System and 3 App}. The limitations are that if your system requires more than 1GB of address space, then it will crash/Blue Screen the moment that limit has been exceeded. The second limitation is that many Windows apps aren't coded to take advantage of more than 2GB of address space because the developers are very much aware the defaults don't allow more than that anyhow. So making this change may result in an unstable system where the apps you have don't use more than 2GB anyhow because they're not coded to do so.


Regarding PAE – This adds an additional table worth of address space that may be assigned to addresses and drivers which have been written and tagged as "/Large_Address_Aware". This means they can read 36 bits worth of addresses instead of just 32.

The limitation is that this *must* be provided for in your programs and drivers in order to work. If your mailman only knows how to read part of the address {maybe he can't read the the street name}, then he can and will sometimes deliver a letter to the wrong place. The same thing is true of PAE - If/when [(Drivers in particular) don't understand the full address then messages can and will often go to the wrong place. In Windows, this is a called a “memory access violation”, and will result in a blue screen every time that happens. Additionally, individual programs under PAE can still only use up to 4 GB, but only *if* they are coded and tagged as Large Address Aware. As mentioned above with the /3gb switch, if the app only understands 2, then it will only use 2. Also, while 32 bit Kernels and drivers can be made aware of PAE, they can still only use 4 GB ranges at a time.

In short: PAE is not that great. In a server environment the number/version/type of programs and drivers - and where they are allowed to run - can be tightly controlled. A strict cycle of Write/Test/Test More/Then Carefully Deploy is how things are done. And hopefully by paid professionals who know what they're doing, and why. If not, then that's what TechReps are for... <laugh> So this works and therefore this functionality is available on server versions of 32 bit Windows (NT, 2003, 2006, etc).

In a consumer environment, this is not true at all. Any idiot who can click a mouse button twice, then click "Continue" can, and generally will go right ahead and install any old thing on their computer and expect it to work. So this functionality in PAE is disabled. You may note that you can look in your system, and it says that PAE is Enabled. Understand this is done for security reasons: DEP (Data Execution Prevention) functionality, which prevents some worms and other undesireable apps from running, requires it. But in the consumer side, /pae is not enabled for the purposes of extra memory space.



Bottom line for ‘regular’ users: If you really want or need to use 4 GB of RAM or more, then you should buy 64-bit hardware and use a 64-bit OS.
April 6, 2009 2:28:50 PM

Yeah, I did get /PAE and the /3GB mixed up there; I updated the OP, nice catch on that one.
April 6, 2009 4:45:19 PM

You need to differentiate between virtual and physical address space. That is very important.

PAE has no influence on the virtual address space and therefore has no influence on applications. So applications don't have to be aware of any extra address space.

"The large address aware" bit that can be enabled for applications has to do with the /3gb switch, not PAE.
!