Memory address

From Wikipedia, the free encyclopedia

Jump to: navigation, search

In computer science, a memory address is an identifier for a memory location, at which a computer program or a hardware device can store a piece of data for later retrieval. By common example, this identifier could be a binary number from a finite monotonically ordered sequence.

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 addressable storage unit was larger than a byte. Examples include the Texas Instruments TMS9900 and the National Semiconductor IMP-16, both of which used 16 bit words.

In a computer program, an absolute address, also called explicit address or specific address, is a memory address that uniquely identifies a location in memory.[citation needed] This is opposed to a relative address, that is not unique and specifies a location only in relation to some other location (the base address).

Contents

[edit] Contents of a memory location

Each memory location, in both ROM and RAM memory, holds a generic binary number of some sort. How it is interpreted, its type, and meaning, and usage, only depends on the context of the instructions which retrieve and manipulate it. Each such coded item has a unique physical position which is described by another unique binary number, the address of that single word, much like each house on a street has a unique number. A pointer is an address itself stored, as data, in some other memory location.

The interesting concept about items stored in memory: not only they can be interpreted as data—text data, binary numeric data, and so forth—but also as instructions themselves, in a uniform manner. This uniformity was introduced with von Neumann architecture and has been prevalent in computers since the 1950s.

Instructions in a storage address are contextually interpreted as command words to the system's main processing unit, and data is retrieved by such instructions placed in an internal and isolated memory structure called a storage register, where the subsequent instruction can manipulate it in conjunction with data retrieved into other internal memory locations (or internal addresses). Registers are the memory addresses within the part of the central processing unit known as the arithmetic logic unit (ALU), which responds to binary instructions (machine code) fetched into instruction registers selecting combinatorial logic determining which data registers should be added, subtracted, circulated (shifted), and so forth at the low machine language level of binary manipulation of data.

[edit] 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 address to be efficiently stored in one word.

However, this is not always the case. 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, or else they would have been limited to a mere 256 byte capacity. Similarly, the 16-bit Intel 8086 supported 20-bit addressing, allowing it to access 1 MiB rather than 64 KiBs of memory. Also popular 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—has the capability of addressing 264 bytes (or 16 exbibytes) which as of 2008 is considered practically unlimited, being far more than the total amount of RAM ever manufactured.

[edit] Virtual memory versus physical memory

Main article: Virtual memory

Virtual memory is a mapping of real memory to page tables. The purpose of virtual memory is to abstract memory allocation, allowing the physical space to be allocated as is best for the hardware (that is, usually in non-contiguous blocks), and to still be seen as contiguous from a program perspective. Virtual memory is supported by some operating systems (for example, Windows but not DOS) in conjunction with the hardware. It is possible to think of virtual memory as a filter, or an alternate set of memory addresses (that are mapped to real address) that allow programs (and by extension, programmers) to read from memory as quickly as possible without requiring that memory to be specifically ordered. 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 on the fly into real memory addresses. Logical address is a synonym of virtual address.


Virtual memory also allows enlarging the address space, the set of addresses a program can utilize and thus allows computers to make use of secondary storage that looks, to programs, like main memory. For example, virtual address space might contain twice as many addresses as main memory with the extra addresses mapped to hard disk space in the form of a swap file (also known as page file). It copies them back (called swapping) into main memory as soon as they are needed. These movements are performed in the background and in a way invisible for programs.

[edit] See also

Personal tools