Wednesday, January 26, 2011

32bit vs 64bit guest VM and RAM usage

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.

  • 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.

    sims : Yeah, address space... Is this the reason why executables are larger as well?
    Massimo : No, they're larger because they are compiled using 64-bit pointers and (usually) variables, instead of 32-bit ones.
    sims : 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.
    Massimo : 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.
    sims : 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!
    From Massimo

0 comments:

Post a Comment