3

In the old times (before virtualization), memory came in powers/multiples of 2, because that is the way memory is manufactured. Nowadays that we create virtual servers that don't have real physical memory, people still create them using powers/multiples of 2.

Is there any reason to continue doing this (performance or others) or is this just something that people do because that is what they are used to?

1
  • I had a machine with 192MiB physical RAM once, bo problem at all. There should be no real reasons to have memory a power of two (I say "should", as there is no way to predict the extent of the brain damage in some operating system...).
    – vonbrand
    Apr 10, 2013 at 13:32

3 Answers 3

1

The answer to your question usually lies more within the guest OSes than the hypervisor used. Windows has, for many year, not really cared whether the memory was laid out in any particular way, save a few requirements on it looking like a PC, so that the boot loader works. Linux is similarly flexible.

Hyper-V, as an example, assigns memory to guest OSes in 2MB chunks. This is only so that the page table hardware in the processors can be set up to use 2MB pages, which is more efficient in that it uses less memory for page tables and fewer entries in the TLB within the processor.

3

There's no reason to continue that trend, at least for VMware... Same for CPUs. I'm not ashamed to say that I have some 3-CPU virtual machines out there 🐼.

3
  • AMD built 3 core phenom processors, so it can't be that bad :)
    – Sven
    Apr 10, 2013 at 13:16
  • 1
    @SvW I thought AMD 3-core CPUs were faulty quad-core ones...
    – tombull89
    Apr 10, 2013 at 13:19
  • @tombull89 I could very well imagine this to be the case but I don't know for a fact. Intel did something similar back in the days with the 80486SX, which was the same as the DX but with the 487 coprocessor disabled.
    – Sven
    Apr 10, 2013 at 13:27
1

I suspect every VM product still uses multiples of four bytes. Not two.

Note that 3 MB is 3072 KB, which is a multiple of two and four (2x1536, or 4x768) even though that is not instantly clear when you look at the value 3.

( As to why multiples of 2 or 4 bytes: Memory access is usually 1, 2 or 4 bytes wide. )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .