Question

As I understand, "32 bit" is equal to 232, which means I can define 4GB of memory with a 32-bit OS. And "64 bit" is 264, which allows 15EB. So, with a 64-bit OS we can put more memory in the computer.

But, I am confused on another point.

We can see in the 32-bit case where we have (say) 4GB of physical memory in the system and we divide that 4GB by the size of a 32-bit Integer, we can store some number of integers (call it N) in memory. And, in 64-bit, the calculation is 4GB divided by the size of a 64-bit integer, so we can only store half as many integers. As a result, with 64-bit, we can't store as many integers with the same memory.

Does this mean that Microsoft cheats us by displaying this memory as "4GB" in both the 32-bit and 64-bit version of the OS?

Was it helpful?

Solution

No, Microsoft isn't cheating by displaying the memory as the same in both cases.

"32-bit" versus "64-bit" refers only to the size of pointers. Both types of systems have 8-bit bytes, and so the same memory will be 4 giga bytes regardless of whether you're using a 32-bit or 64-bit operating system.

It's not just bytes that are the same size. A normal integer that is defined as int (in C) is 32 bits on both systems. Even an integer defined as long int is 32 bits on both systems if it's Windows (although Linux makes it 64 bits on 64-bit systems). So you can see that the "32-bit" or "64-bit" term applied to the OS has very little to do with the size of things other than pointers.

And, beyond that, most of the data stored in the computer's memory is not pointers, or even integers that might or might not change sizes; it's pixels of images or bytes of strings or 16-bit samples in sound files or computer instructions in programs. None of those change sizes at all. As a result, you can generally store the same amount of "real information" in the same amount of memory regardless of whether you're using a 32-bit or 64-bit operating system.

(Now, there is the point that of course some data in memory is pointers, and so when you're dealing with things that are mostly pointers, using a 64-bit operating system can mean that you use more memory for the same data. On very rare occasions that matters, but they are very rare. And, even so, it's still the same number of bytes of memory; you just need more of it.)

OTHER TIPS

x86 uses byte addressing so 4GB is the same amount of data regardless of 32 or 64-bit OS.

Regarding memory usage, x86_64 was carefully designed so that instruction size won't increase much or remain the same. Code size may even be shorter in some cases due to less register spilling required. Most importantly, not every data type increases in size. Most operations still use 32-bit variables. The only type whose size is really doubled is pointer (and long in *nix). So in fact memory usage on a 64-bit program is not twice the number on a 32-bit counterpart.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top