1

Why does a 32bit domU (Xen guest VM) use less RAM than a 64bit?

Notes: The same software complied for a different arch(AMD64 vs. 686). Obviously this is Linux or BSD or something easily ported. Maybe this is also a good one for SO.

I've read this is so. I can guess why, but I'd like to hear everyone's comments.

d-_-b
  • 1,104
  • 3
  • 11
  • 23

1 Answers1

4

Under the same workload, a 32-bit system will always use less memory than a 64-bit one, mainly due to two reasons: the bigger size of executables, pointers, variables etc., and the additional kernel overhead of managing a bigger address space.

This of course doesn't happen only to virtual machines, but to physical systems too.

Massimo
  • 68,714
  • 56
  • 196
  • 319
  • Yeah, address space... Is this the reason why executables are larger as well? – d-_-b Apr 18 '10 at 14:45
  • No, they're larger because they are compiled using 64-bit pointers and (usually) variables, instead of 32-bit ones. – Massimo Apr 18 '10 at 14:50
  • No? What do you mean? A 64bit machine has a larger memory address space than 32-bit. Would not that make those pointers larger? You actually have to store a larger address. At least that was my guess. – d-_-b Apr 19 '10 at 02:30
  • Well, we could say yes and no at the same time :-) The executables are larger not *directly* because of the bigger address space... but because they're compiled using larger pointers; in order to address it, of course. – Massimo Apr 19 '10 at 05:31
  • 1
    OK, good, I'm not a retard. I just wanted to make sure I understood what I was reading. In that case I will make my VMs 32bit - since none of them have access to more that 4GB of RAM anyway. Thanks for explaining that! – d-_-b Apr 22 '10 at 14:23
  • So can we say for vServers with RAM below 4GB of Memory it is generally wiser to install a 32bit-based OS? Phoronix however tested the Ubuntu 12 LTS 64bit vs 32bit and the 64bit version won by a clear margin. http://www.phoronix.com/scan.php?page=article&item=ubuntu_1204_3264&num=3 –  Oct 25 '13 at 00:03
  • This strongly depends on your workload. Some of them actually benefit from larger memory words, which make them able to operate on up to double the data in a given time. But this question wasn't about performance, it was about memory usage. – Massimo Oct 25 '13 at 07:18