Memory address
This article needs additional citations for verification. (February 2018) |
In
Types
Physical addresses
A
Logical addresses
A
Unit of address resolution
Most modern computers are
Some older computers (
Word size versus address size
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 "
However, this does not always hold true. Computers can have memory addresses larger or smaller than their word size. For instance, many
In theory, modern byte-addressable
Contents of each memory location
Each memory location in a
Some early programmers combined instructions and data in words as a way to save memory, when it was expensive: The
Address space in application programming
In modern
- Machine code, including:
- program's own code (historically known as code segment or text segment);
- shared libraries.
- Data, including:
- initialized data (data segment);
- uninitialized (but allocated) variables;
- run-time stack;
- heap;
- memory mapped files.
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,
Addressing schemes
A computer program can access an address given explicitly – in low-level programming this is usually called an absolute address, or sometimes a specific address, and is known as
Mapping logical addresses to physical and virtual memory also adds several levels of indirection; see below.
Memory models
Many programmers prefer to address memory such that there is no distinction between code space and data space (see above), as well as from physical and virtual memory (see above) — in other words, numerically identical pointers refer to exactly the same byte of RAM.
However, many early computers did not support such a flat memory model — in particular, Harvard architecture machines force program storage to be completely separate from data storage. Many modern DSPs (such as the Motorola 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.
Memory models in x86 architecture
Early x86 processors use the segmented memory model addresses based on a combination of two numbers: a memory segment, and an offset within that segment.
Some segments are implicitly treated as code segments, dedicated for
See also
- Memory allocation
- Memory management unit (MMU)
- Memory model (programming)
- Memory protection
- Memory segmentation
- Offset (computer science), also known as a displacement
- Page table
References
- ^ Abrahamson, Karl R. (Aug 20, 2022). "5.10.1. The Memory and Memory Addresses". East Carolina University. Retrieved Feb 3, 2023.