Memory address

Memory address

A digital computer's memory, more specifically main memory, consists of many memory locations, each having a memory address, a number, analogous to a street address, at which computer programs store (except when the address is in mask ROM) and retrieve, machine code or data. Most application programs do not directly read and write to physical addresses. Rather, they address logical addresses, or virtual addresses, using operating system APIs. Generally only system software, i.e. the BIOS, operating systems, and some specialized utility programs (e.g., memory testers), address physical memory using machine code operands or processor registers, instructing the CPU to direct a hardware device, called the memory controller, to use the memory bus or system bus, or separate control, address and data busses, to execute the program's commands. The memory controllers' bus consists of a number of parallel lines, each represented by a binary digit (bit). The width of the bus, and thus the number of addressable storage units, and the number of bits in each unit, varies among computers.

In a computer program, an absolute address, (sometimes called an explicit address or specific address), is a memory address that uniquely identifies a location in memory.[citation needed] This is different from a relative address, that is not unique and specifies a location only in relation to somewhere else (the base address). Virtual memory also adds a level of indirection.

Contents

Unit of address resolution

Most modern computers are byte-addressable, with each address identifying a single eight bit byte or character of storage; data too large to be stored in a single byte may reside in multiple bytes occupying a sequence of consecutive addresses. Other computers are word-addressable, with addressable storage units larger than a byte. For example, the Data General Nova minicomputer, and the Texas Instruments TMS9900 and National Semiconductor IMP-16 microcomputers used 16 bit words, and there were many 36-bit mainframe computers which used 18-bit word addressing. The efficiency 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, a byte-addressable machine with a 20-bit address bus (e.g. Intel 8086) can address 220 (1,048,576) memory locations, or one megabyte of memory, while a 32-bit bus (e.g. Intel 80386) addresses 232 (4,294,967,296) locations, or a 4 gigabyte address space. In contrast, a 36-bit word-addressable machine with an 18-bit bus addresses only 218 (262,144) locations, but 1.125 megabytes—slightly more than the 8086.

Some older computers (decimal computers), were decimal digit-addressable. For example, each address in the IBM 1620's magnetic-core memory identified a single six bit binary-coded decimal digit, consisting of a parity bit, flag bit and four numerical bits. 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).

Contents of each memory location

Each memory location in a stored-program computer holds a binary number of some sort. Its interpretation, as data of some data type or as an instruction, and use are determined by the instructions which retrieve and manipulate it. A pointer is a data type whose value is the address of another memory location where data is stored.

Some early programmers combined instructions and data in words as a way to save memory, when it was expensive: The Manchester 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 as viruses treat themselves sometimes as data and sometimes as instructions. Self-modifying code is generally deprecated 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's state, but is still sometimes used deliberately, with great care.

Word size versus address size

A word size is characteristic to a given computer architecture. It denotes the number of bits that a CPU can process at one time. Historically it has been sized in multiples of four and eight bits (nibbles and bytes, respectively), so sizes of 4, 8, 12, 16, 24, 32, 48, 64, and larger came into vogue with technological advances.

Very often, when referring to the word 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 seems logical and useful, as it allows one memory address to be efficiently stored in one word.

But this does not always hold. Computers often have memory addresses larger or smaller than their word size. For instance, almost all 8-bit processors, such as 6502, supported 16-bit addresses— if not they would have been limited to a mere 256 byte memory. The 16-bit Intel 8088 had only an 8-bit external memory bus on early IBM PCs, and the 16-bit Intel 8086 supported 20-bit addressing, allowing it to access 1 MiB rather than 64 KiBs of memory. Popular Intel Pentium processors since introduction of Physical Address Extensions (PAE) support 36-bit physical addresses, while generally having only a 32-bit word.

A modern byte-addressable 64-bit computer—with proper OS support can address 264 bytes (or 16 exbibytes) which as of 2011 is considered practically unlimited.

Virtual memory versus physical memory

Virtual memory is now universally used on desktop machines. It maps physical memory to different addresses using page tables. By doing so the operating system can decide to allocate memory as it deems most efficient without causing the program to halt from a long garbage collection process. Some literature[citation needed] suggests that, on the whole, garbage collection is the most efficient of memory reclamation strategies[dubious ], but it is not ideal if it cuts in to 'tidy up' memory just as the program is controlling the firing of a missile or a landing on the moon, because it is non-deterministic.

The physical blocks of memory (typically 4 kb chunks) are mapped to virtual addresses by a virtual memory program in the kernel, and supported by the processor hardware, though it was formerly done all in software. The purpose of virtual memory is to abstract memory allocation, allowing the physical space to be allocated as best for the hardware (that is, usually in good sized blocks), and to still be seen as contiguous from a program or compiler's perspective. Virtual memory is supported by some operating systems (for example Linux and Windows but not MS-DOS). One may think of virtual memory as a filter, or an alternate set of memory addresses that allow programs to read from memory as quickly as possible without requiring it to be at a particular place. Programs use these contiguous virtual addresses, rather than real, and often fragmented, physical addresses, to store instructions and data. When the program is actually executed, the virtual addresses are translated by the processor[dubious ] into real memory addresses. logical address is a synonym for virtual address.

Virtual memory also effectively allows the address space to be larger than - or rather, extend beyond - the amount of real (or physical) memory available; the computer can put rarely-accessed pages into secondary storage (similar, at a level, in behavior to CPU cache) and use the real memory (RAM) for new or active tasks. So the virtual address space might contain, say, twice as many addresses as main memory with the extra addresses mapped to hard disk space in the form of a swap file (used in Linux) or page file (the default on Windows XP and later MS operating systems). When required they are copied back (called swapping) into main memory as soon as they are needed. These movements are performed, typically, as a background process - and in that sense are transparent to programs. However, if due care is not taken, this can often lead to thrashing.

See also

References


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • memory address — ➔ address1 * * * memory address UK US noun [C] IT ► a number that shows where particular data and instructions are stored in a computer s memory …   Financial and business terms

  • memory address — atmintinės adresas statusas T sritis automatika atitikmenys: angl. memory address; storage address vok. Speicheradresse, f rus. адрес запоминающего устройства, m; адрес памяти, m; адрес ячейки памяти, m pranc. adresse de mémoire, f …   Automatikos terminų žodynas

  • Memory address register — The Memory Address Register (MAR) is a CPU register that either stores the memory address from which data will be fetched to the CPU or the address to which data will be sent and stored. In other words, MAR holds the memory location of data that… …   Wikipedia

  • Memory Address Register und Memory Buffer Register — Der Memory Address Register (MAR) und der Memory Buffer Register (MBR) sind Register einer von Neumann CPU. Sie dienen als schnelle Zwischenspeicher und verringern die negativen Auswirkungen des von Neumann Flaschenhalses. Die meisten von Neumann …   Deutsch Wikipedia

  • Memory Address Register — Der Memory Address Register (MAR) und der Memory Buffer Register (MBR) sind Register einer von Neumann CPU. Sie dienen als schnelle Zwischenspeicher und verringern die negativen Auswirkungen des von Neumann Flaschenhalses. Die meisten von Neumann …   Deutsch Wikipedia

  • memory address — number that indicates the location of information within the memory of a computer …   English contemporary dictionary

  • memory address —    The exact location in memory that stores a particular data item or program instruction …   Dictionary of networking

  • memory address —    Storage locations that are distinguished by their addresses …   IT glossary of terms, acronyms and abbreviations

  • Memory disambiguation — is a set of techniques employed by high performance out of order execution microprocessors that execute memory access instructions (loads and stores) out of program order. The mechanisms for performing memory disambiguation, implemented using… …   Wikipedia

  • Memory segmentation — is the division of computer memory into segments or sections. Segments or sections are also used in object files of compiled programs when they are linked together into a program image, or the image is loaded into memory. In a computer system… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”