Memory address

From Free net encyclopedia

In computer science, a memory address is a unique identifier for a memory location at which a CPU or other device can store a piece of data for later retrieval. In modern byte-addressable computers, each address identifies a single byte of storage; data too large to be stored in a single byte may reside in multiple bytes occupying a sequence of consecutive addresses. Some microprocessors were designed to be word-addressable, so that the typical storage unit was actually larger than a byte. Examples include the Texas Instruments TMS9900 and the National Semiconductor IMP-16, both of which used 16 bit words.

Many modern computers support virtual memory, which introduces the notions of virtual and physical addresses. Physical addresses are those the computer's circuitry uses to signal an address to RAM chips; to retrieve some data, its physical address is transmitted from the CPU to the RAM on an address bus, and the RAM returns with the corresponding data to the CPU. Virtual addresses, on the other hand, are the addresses manipulated by the operating system running on the computer. When the application software requests some data, the computer first translates the data's virtual address into a physical address before being transmitted to the RAM. This translation is invisible to software, and allows the software to operate independently of its location in physical memory, giving the operating system the freedom to allocate and reallocate memory as needed to keep the computer running efficiently. Because the virtual memory size can be much larger than the physical RAM available to a computer, the operating system can use a page file and/or a swap file to temporarily move pages of memory to secondary storage when they are either not being used, or when the process that is using them is idle.

Very often, when referring to the word size of a modern computer, one is also describing the size of virtual memory addresses on that computer. For instance, a computer said to be "32-bit" usually treats memory addresses as 32-bit integers; a byte-addressable 32-bit computer can address <math>2^{32} = 4,294,967,296</math> bytes of memory, or 4 gigabytes. However, older computers often supported memory addresses larger than their word size, or else their memory capacity would have been unreasonably small. For instance, the 8-bit 6502 supported 16-bit addresses, or else it would have been limited to a mere 256 bytes. Similarly, the 16-bit Intel 8086 supported 20-bit addresses, allowing it to access 1 megabyte rather than 64 kilobytes. A byte-addressable 64-bit computer can address <math>2^{64}</math> bytes (or 16 exabytes) which as of 2005 is considered practically unlimited, being far more than the total amount of RAM ever manufactured.

Depending upon its underlying architecture, the performance of a computer may be hindered by unaligned access to memory. As an example, a 16 bit computer with a 16 bit memory data bus such as an Intel 8086 generally works most efficiently if the data is aligned so that it starts on an even address, so that fetching one 16 bit value requires a single memory read operation. If the 16 bit data value starts at an odd address, the processor may actually need to perform two memory read cycles to load the value into it, i.e. one for the low address (throwing half of it away) and then a second to load the high address (again throwing half of the retrieved data away).

See also