Search code examples
memoryandroid-emulatorram

Why is RAM in powers of 2?


Why is the amount of RAM always a power of 2?

512, 1024, etc.

Specifically, what is the difference between using 512, 768, and 1024 RAM for an Android emulator?


Solution

  • Memory is closely tied to the CPU, so making their size a power of two means that multiple modules can be packed requiring a minimum of logic in order to switch between them; only a few bits from the end need to be checked (since the binary representation of the size is 1000...0000 regardless of its size) instead of many more bits were it not a power of two.

    Hard drives are not tied to the CPU and not packed in the same manner, so exactness of their size is not required.

    from https://superuser.com/questions/235030/why-are-ram-size-usually-in-powers-of-2-512-mb-1-2-4-8-gb

    as referenced by BrajeshKumar in the comments on the OP. Thanks Brajesh!