This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Memory address" – news ·newspapers ·books ·scholar ·JSTOR(February 2018) (Learn how and when to remove this message) |

Incomputing, amemory address is a reference to a specificmemory location in memory used by bothsoftware andhardware.[1] These addresses are fixed-length sequences ofdigits, typically displayed and handled asunsignedintegers. This numerical representation is based on the features of CPU (such as theinstruction pointer and incrementaladdress registers). Programming language constructs often treat the memory like an array.
Adigital computer'smain memory consists of manymemory locations, each identified by a unique physical address (a specific code). The CPU or other devices can use these codes to access the corresponding memory locations. Generally, onlysystem software (such as theBIOS, operating systems, and specializedutility programs likememory testers) directly addresses physical memory using machine code instructions or processor registers. These instructions tell the CPU to interact with a hardware component called the memory controller. The memory controller manages access to memory using the memory bus or a system bus, or through separate control, address, and databuses, to execute the program's commands. The bus managed by the memory controller consists of multiple parallel lines, each representing a binary digit (bit).
Acomputer program uses memory addresses to executemachine code, and to store and retrievedata. In early computers, logical addresses (used by programs) and physical addresses (actual locations in hardware memory) were the same. However, with the introduction ofvirtual memory, mostapplication programs do not deal directly with physical addresses. Instead, they uselogical orvirtual addresses, which are translated to physical addresses by the computer'smemory management unit (MMU) and the operating system'smemory mapping mechanisms.
Most modern computers arebyte-addressable. Each address identifies a single 8-bitbyte (octet) of storage. Data larger than a single byte may be stored in a sequence of consecutive addresses. There existword-addressable computers, where the minimal addressable storage unit is exactly the processor'sword.[a] For example, theData General Novaminicomputer, and theTexas Instruments TMS9900 andNational Semiconductor IMP-16microcomputers, used 16-bitwords, and there are many oldmainframe computers that use36-bit word addressing (such as theIBM 7090, with 15-bit word addresses, giving an address space of 215 36-bit words, approximately 128 kilobytes of storage, and theDEC PDP-6/PDP-10, with 18-bit word addresses, giving an address space of 218 36-bit words, approximately 1 megabyte of storage), not byte addressing. The range of addressing of memory depends on the bit size of the bus used for addresses – the more bits used, the more addresses are available to the computer. For example, an 8-bit-byte-addressable machine with a 20-bitaddress bus (e.g.Intel 8086) can address 220 (1,048,576) memory locations, or oneMiB of memory, while a 32-bit bus (e.g.Intel 80386) addresses 232 (4,294,967,296) locations, or a 4GiB address space. In contrast, a 36-bit word-addressable machine with an 18-bit address bus addresses only 218 (262,144) 36-bit locations (9,437,184 bits), equivalent to 1,179,648 8-bit bytes, or 1152KiB, or 1.125 MiB — slightly more than the 8086.
A small number of older machines arebit-addressable. For example, a variable filed length (VFL) instruction on theIBM 7030 "Stretch" specifies a bit address, a byte size of 1 to 8 and a field length.
Some older computers (decimal computers) aredecimaldigit-addressable. For example, each address in theIBM 1620'smagnetic-core memory identified a single six bitbinary-coded decimal digit, consisting of aparity bit,flag bit and four numerical bits.[2] The 1620 used 5-digit decimal addresses, so in theory the highest possible address was 99,999. In practice, the CPU supported 20,000 memory locations, and up to two optional external memory units could be added, each supporting 20,000 addresses, for a total of 60,000 (00000–59999).
Some older computers are character-addressable, with 6-bitBCD characters containing a 2-bit zone and a 4-bit digit; the characters in an address only have digit values representing 0–9. Typically some of the zone bits are part of the address and some are used for other purposes, e.g., index register, indirect address.[3]
Some older computers are decimal-word addressable, typically with 4-digit addresses.[4] In some machines the address fields also select index registers, restricting the range of possible address.[5]
Word size is a characteristic ofcomputer architecture denoting the number of bits that a CPU can process at one time. Modern processors, includingembedded systems, usually have a word size of 8, 16, 24, 32 or 64 bits; most current general-purpose computers use 32 or 64 bits. Many different sizes have been used historically, including 8, 9, 10, 12, 18, 24, 36, 39, 40, 48 and 60 bits.
Very often, when referring to theword size of a modern computer, one is also describing the size of address space on that computer. For instance, a computer said to be "32-bit" also usually allows 32-bit memory addresses; a byte-addressable 32-bit computer can address 232 = 4,294,967,296 bytes of memory, or 4 gibibytes (GiB). This allows one memory address to be efficiently stored in one word.
However, this does not always hold true. Computers can have memory addresses larger or smaller than their word size. For instance, many8-bit processors, such as theMOS Technology 6502,supported 16-bit addresses— if not, they would have been limited to a mere 256bytes of memory addressing. The 16-bitIntel 8088 andIntel 8086 supported 20-bit addressing viasegmentation, allowing them to access 1 MiB rather than 64 KiB of memory. All IntelPentium processors since thePentium Pro includePhysical Address Extensions (PAE) which support mapping 36-bit physical addresses to 32-bit virtual addresses. Many earlyLISP implementations on, e.g.,36-bit processors, held 2 addresses per word as the result of acons. Some early processors held 2 and even 3 addresses per instruction word.
In theory, modern byte-addressable64-bit computers can address 264 bytes (16exbibytes), but in practice the amount of memory is limited by the CPU, thememory controller, or theprinted circuit board design (e.g., number of physical memory connectors or amount of soldered-on memory).
Each memory location in astored-program computer holds abinary number ordecimal numberof some sort. Its interpretation, as data of somedata type or as an instruction, and use are determined by theinstructions which retrieve and manipulate it.
Some early programmers combined instructions and data in words as a way to save memory, when it was expensive: TheManchester Mark 1 had space in its 40-bit words to store little bits of data – its processor ignored a small section in the middle of a word – and that was often exploited as extra data storage.[citation needed]Self-replicating programs such asviruses treat themselves sometimes as data and sometimes as instructions.Self-modifying code is generallydeprecated nowadays, as it makes testing and maintenance disproportionally difficult to the saving of a few bytes, and can also give incorrect results because of the compiler or processor's assumptions about the machine'sstate, but is still sometimes used deliberately, with great care.
In modernmultitasking environment, anapplicationprocess usually has in its address space (or spaces) chunks of memory of following types:
Some parts of address space may be not mapped at all.
Some systems have a "split"memory architecture where machine code, constants, and data are in different locations, and may have different address sizes.For example,PIC18 microcontrollers have a 21-bit program counter to address machine code and constants in Flash memory, and 12-bit address registers to address data in SRAM.
A computer program can access an address given explicitly – in low-level programming this is usually called anabsolute address, or sometimes a specific address, and is known aspointer data type in higher-level languages. But a program can also userelative address which specifies a location in relation to somewhere else (thebase address). There are many more indirectaddressing modes.
Mapping logical addresses to physical and virtual memory also adds several levels of indirection; see below.
Many programmers prefer to address memory such that there is no distinction between code space and data space (seeabove), as well as from physical and virtual memory (seeabove) — in other words, numerically identical pointers refer to exactly the same byte of RAM.
However, many early computers did not support such aflat memory model — in particular,Harvard architecture machines force program storage to be completely separate from data storage.Many modernDSPs (such as theMotorola 56000) have three separate storage areas — program storage, coefficient storage, and data storage. Some commonly used instructions fetch from all three areas simultaneously — fewer storage areas (even if there were the same total bytes of storage) would make those instructions run slower.
Early x86 processors use thesegmented memory model addresses based on a combination of two numbers: amemory segment, and anoffset within that segment.
Some segments are implicitly treated ascode segments, dedicated forinstructions,stack segments, or normaldata segments. Although the usages are different, the segments do not have differentmemory protections reflecting this.In theflat memory model all segments (segment registers) are generally set to zero, and only offsets are variable.
In the360/65 and360/67, IBM introduced a concept known as prefixing.[6] Prefixing is a level of address translation that applies to addresses in real mode and to addresses generated by dynamic address translation, using a unique prefix assigned to each CPU in a multiprocessor system. On the 360/65, 360/67 and every successor prior toz/Architecture, it logically swaps a 4096 byte block of storage with another block assigned to the CPU. On z/Architecture,[7] prefixing operates on 8196-byte blocks. IBM classifies addresses on these systems as:[8]
On the 360/65, on S/370 models without DAT and when running with translation turned off, there are only a flat real address space and a flat absolute address space.
On the 360/67, S/370 and successors throughS/390, when running with translation on, addresses contain a segment number, a page number and an offset. Although early models supported both 2 KiB and 4 KiB page sizes, later models only supported 4 KiB. IBM later added instructions to move data between a primary address space and a secondary address space.
S/370-XA added 31-bit addresses, but retained the segment/page/offset hierarchy with 4 KiB pages.
ESA/370 added 16 access registers (ARs) and an AR access control mode, in which a 31-bit address was translated using the address space designated by a selected AR.
z/Architecture supports 64-bit virtual, real and absolute addresses, with multi-level page tables.
The relocation procedure applies to the first 4,096 bytes of storage. This area contains all permanent storage assignments and, generally, has special significance to supervisory programs. The relocation is accomplished by inserting a 12-bit prefix in each address which has the high-order 12 bits set to zero and hence, pertains to location 0-4095.
Prefixing provides the ability to assign the block of real addresses containing assigned storage locations to a different block in absolute storage for each CPU, thus permitting more than one CPU sharing main storage to operate concurrently with a minimum of interference, especially in the processing of interruptions.