Memory
Also known as: RAM, main memory
Fast, temporary storage where a running program keeps the data it is actively using.
- Primary domain
- Hardware & Architecture
- Sub-category
- Printed Circuit Boards, Peripherals & Integrated Circuits
In simple terms
Memory is a computer’s short-term workspace. It is much faster than disk and much smaller. When a program is running, its code and the data it is currently working on live in memory.
More detail
When people say “memory” they usually mean RAM (Random Access Memory). It is random access because the CPU can read or write any address in roughly the same amount of time, unlike a tape or a spinning disk.
Computers actually have a memory hierarchy that trades capacity for speed:
| Level | Typical size | Typical access time |
|---|---|---|
| CPU registers | bytes | < 1 ns |
| L1 cache | tens of KB | ~1 ns |
| L2 / L3 cache | MBs | ~10 ns |
| Main memory | GBs | ~100 ns |
| SSD storage | hundreds of GB to TBs | tens of µs |
| HDD storage | TBs | ~10 ms |
Modern RAM is volatile: turn the power off and it forgets everything. That is why long-term data lives in storage.
Why it matters
Most performance problems in modern software are really memory problems — the CPU is fast, but waiting for data to come from RAM (or worse, from disk) is slow. Understanding the memory hierarchy is the foundation of writing fast code.
Real-world examples
- A laptop with “16 GB of RAM” has 16 GB of main memory.
- A browser tab using “200 MB” is taking 200 MB of memory.
- The “out of memory” error happens when a program asks for more RAM than the system can provide.
Common misconceptions
- “Memory and storage are the same thing.” Memory is fast and forgets when the power goes off; storage is slower and remembers.
- “More RAM always makes a computer faster.” Only up to the point where you stop running out. Past that, more RAM mostly does nothing.
Learn next
For data that has to survive a power cycle, look at storage.
Read this in a learning path
All paths →This topic is part of 3 learning paths. Start in context to keep prev/next and progress tracking.
- Read this in From Hardware to the WebTrace one connection from the CPU on your laptop through the operating system, the network, and the web browser. Start here View the whole path
- Read this in How Computers WorkA beginner-friendly path from bits to operating systems — the smallest mental model of a modern computer. Start here View the whole path
- Read this in OS ConceptsThe minimum viable mental model of an operating system — processes, threads, scheduling, memory, files, and the kernel that ties it together. Start here View the whole path
Relationships
- Requires
- Related
- Next
- Leads to
Neighborhood
A visual companion to the relationships above. Click any node to visit that topic.