/ˈmɛməri/
noun … “Storage for data and instructions.”
Memory is the component or subsystem in a computing environment responsible for storing and retrieving data and program instructions. It encompasses volatile storage such as RAM, non-volatile storage like ROM, and other forms including cache, registers, and persistent memory. Effective memory management is critical for performance, multitasking, and ensuring data integrity across CPU operations.
Key characteristics of Memory include:
- Volatility: volatile memory loses data when power is removed (e.g., RAM), while non-volatile memory retains it (e.g., ROM, SSDs).
- Hierarchy: memory is structured in layers, including registers, caches, main memory, and secondary storage, balancing speed and capacity.
- Addressability: each memory location has a unique address used by the CPU to read or write data.
- Access time: memory types differ in latency and bandwidth, influencing overall system performance.
- Persistence and durability: persistent memory retains state across power cycles, supporting file systems and databases.
Workflow example: In a typical program, data is loaded from persistent storage into RAM for computation. The CPU accesses instructions and variables from memory, often leveraging cache to minimize latency:
int main() {
int x = 42 -- Stored in RAM or CPU register
int y = x * 2
std::cout << "Result: " << y << std::endl
}Here, Memory holds the variables x and y, while instructions execute from memory locations accessible to the CPU.
Conceptually, Memory is like a library where books (data) are stored and retrieved by readers (the CPU) when needed. Fast access to frequently used books improves efficiency, while less-used volumes may reside in the stacks.
See RAM, ROM, CPU, Cache, Memory Management.