Why is RAM in powers of 2?

假如想象 提交于 2019-12-10 14:19:05

问题


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?


回答1:


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 referred by BrajeshKumar in the comments on the OP. Thanks Brajesh!




回答2:


Because computers deal with binary values such as 0 and 1, because registers are on(1) or off(0)

So if you use powers of 2, your hardware will use 100% of the registers.

If computers used ternary values in their circuits, then we'd have memory, processors and anything else in powers of 3.




回答3:


I think, it is related with the number of bits in an address bus (or bits used to select between address spaces). n bits can address 2^n bytes, so whenever the number of address bits increases to n+1, automatically the space increases by a factor of 2. The manufacturers use their maximum address capacity when including memory chips to the design. In Android emulator, the increase in RAM may make your program more efficient, because when your application exceeds the RAM, a part of ROM (non-volatile memory) and it is slower.



来源:https://stackoverflow.com/questions/22096327/why-is-ram-in-powers-of-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!