Tutorial Categories:

HTML/CSS JavaScript/AJAX Server-Side Marketing General Comp-Sci

Items in Memory and Their Addresses

By Justin Poirier

Traditional computers use binary digits to represent all data. When a computer system’s design dictates that a given sequence of adjacent 1’s and 0’s somewhere in memory1 is meant to represent a piece of data, the total number of possible data items that can be represented depends on the number of bits in the sequence. It increases twofold for every bit that is added, since the previous total number of permutations of the bits still applies to those original bits, but they can now be arranged in those permutations with the new bit being 0, as well as with the new bit being 1. It can be seen that the number of possible data items for a sequence of bits is always a power of 2, ie. a number in the sequence 2, 4, 8, 16, 32, 64, 128, 256, 512, ... As an example, in modern personal computers the most basic unit of memory is the byte, which is 8 bits. A byte can hold 2 ^ 8 = 256 possible data items.

The number of bits as a power of 2 also equals the highest number that can be stored in a memory unit, when using it to store the binary number system representation of a number. This should be clear, since number systems specify that in the formation of numbers, a new digit should only be added if no combinations of less significant digits can represent the number.

The most important implication of this fact arises when the size of a given unit of memory is chosen as the number of bits used by the system to refer to the addresses of memory locations themselves. Once this number is chosen, the highest possible memory address will be fixed. The maximum amount of memory that can be installed on the system will also become fixed, since addresses will only be able to fall between 1 and the highest possible address. This range is called the address space of the system.

The number of bits used for addresses is often itself a power of 2. System or CPU architectures named after a power-of-2 number of bits, for example the “32-bit” and “64-bit” systems prevalent today, are so named because parts of the system accommodate, among other things, addresses expressed in these numbers of bits. These numbers are powers of 2 because it allows certain CPU instructions involving addresses to be carried out using shortcuts.

The powers of 2 can also be noticed in the capacities of the RAM modules that are plugged into the motherboards of desktop computers, for example 512 MB or 1024 MB (1 GB). In this case the power of 2 in the labelled capacity is actually the number of MB which are themselves powers of 2, so the actual number of bits is a much higher power of 2, e.g. 512 MB is 2 ^ 32 bits. The reason these capacities are powers of 2 is related to the address spaces of the buses on the modules themselves, which like all address spaces, are powers of 2. It is desirable that there be a memory location for every possible address in the space, so that when multiple modules are used in combination to make up the entire memory of the system, their internal memory addresses can be more easily consolidated into the address space of the system as a whole.

1or a register, or on a bus