What is RAM (computer memory)?
RAM is the fast main memory the CPU uses while a program runs; the disk is slower storage the OS copies from.
Published here , updated · 5 sources · Resume reading
RAM (random access memory) is the computer's fast main memory, also called main memory in OpenStax [1]. The CPU runs programs from there after the OS copies them off slower disk storage [1]. Related: stack vs heap memory, how a CPU runs an instruction.
Quick start (under a minute)
Read how much main memory this Linux host reports:
grep MemTotal /proc/meminfo | head -1You should see a line such as MemTotal: followed by a size in kB. That kernel counter is main memory, not disk.
Worked example on this draft host
Observed on this draft host (Linux /proc/meminfo, 2026-12-03):
MemTotal: 16387328 kBRoughly 15 GiB of RAM is visible to the kernel on this VM. Your laptop will print a different number. The teaching point is that specs and MemTotal both describe the same layer: bytes the OS can map for running programs [1].
Put the desk next to the warehouse
OpenStax Main Memory: disks are too slow for steady CPU work, so machines use main memory, also called RAM [1]. When marketing lists "16 GB RAM," that is this layer. When you launch an app, the OS brings the executable and needed data from disk into RAM, then the CPU fetches instructions from RAM addresses [1].
OpenStax chapter 5.5 continues the hierarchy with caches and performance tradeoffs [2]. Stop here at RAM as the working desk, not cold storage capacity.
Know what random access is trying to say
Wikipedia: RAM is random-access because any location can be read or written in about the same time, unlike tape that must pass every earlier byte [3]. Teaching shorthand: the CPU can jump to an address without scanning from zero. That property does not mean unlimited memory or permanent storage.
Power loss clears ordinary DRAM contents. Battery-backed RAM and flash exist for special cases; everyday laptops still treat RAM as volatile working space [3].
How the OS uses RAM while you work
One browser tab is not one byte. The kernel maps virtual address spaces for each process, backs them with physical RAM pages, and reclaims pages when pressure rises [1] [2]. Symptoms users recognize:
| Symptom | Plain-language link to RAM |
|---|---|
| Many apps open, fan spins | More unique pages in RAM; less free |
| Tab discarded / reloads | Browser or OS reclaimed memory |
| Swap or thrashing | OS moved cold pages to disk; latency spikes |
Exact policies differ between Windows, macOS, and Linux. The layer diagram stays valid even when names like "swap" or "memory compression" differ.
Measure free memory without guessing
On Linux, free -h summarizes total, used, and available memory. The available column accounts for reclaimable cache [1]. A teaching read:
free -h | head -2Observed on this draft host (2026-12-03):
total used free shared buff/cache available
Mem: 15Gi 10Gi 2.8Gi 17Mi 2.3Gi 4.8GiHigh buff/cache with solid available is normal: the kernel keeps recently read disk blocks in RAM until applications need the space.
Bandwidth versus latency in the hierarchy
OpenStax memory hierarchy: each step closer to the CPU is faster and smaller [2]. Programmers feel this as cache misses and page faults even when they never say "DRAM." When a tutorial claims "load everything into memory," it still means RAM sized to your working set, not infinite storage [1].
| Layer | Teaching role |
|---|---|
| Disk | Capacity and persistence |
| RAM | Active code and data for all running processes |
| CPU caches | Automatic hot copies of RAM lines |
| Registers | Current instruction operands |
Leave process layout for the next posts
Inside one process, programmers still distinguish stack and heap lifetimes. That is stack vs heap memory, not a second definition of RAM. The fetch-decode-execute loop that pulls bytes from main memory is how a CPU runs an instruction.
Buying a larger SSD does not add main memory. SSD speed helps how fast cold data loads into RAM, but it does not replace RAM capacity for holding the working set at once [1].
Swap and compression in one paragraph
When RAM pressure rises, Linux may move cold pages to swap storage or compress inactive pages depending on kernel version and vm.swappiness [1] [2]. Users perceive this as the machine "getting slow." The fix is often fewer concurrent tabs or more RAM, not only a faster SSD. SSD helps reload swapped pages faster, but swapping still means disk latency compared with DRAM [1].
Developers profiling memory should distinguish RSS growth from normal file cache usage in free output. Killing cache manually rarely helps sustained workloads.
Embedded and mobile SoCs still follow the same teaching ladder at different capacities. OpenStax uses desktop examples because the vocabulary transfers: main memory holds the running program, storage holds what survives reboot [1] [2].
Cloud VMs advertise RAM like physical laptops because the guest OS still maps main memory for processes [1]. Container limits (cgroups memory caps) add another knob: a process may get OOM-killed inside the container even when the host has free RAM elsewhere. The hierarchy diagram on this page still applies: containers share the host's main memory budget. Monitor OOM events in kernel logs when services restart without explanation.
Mistakes that waste a week
Equating GB of storage with GB of RAM in a shopping cart.
Thinking "clear RAM" utilities permanently speed up a machine. They often just force caches closed.
Unused RAM is wasted. The OS uses free RAM for disk cache until apps need it.
More RAM always fixes slow code. Algorithmic cost and disk bottlenecks still dominate some workloads.
Confusing VRAM on a GPU with system RAM. They are separate pools with separate limits.
Using "memory leak" to describe any high RAM usage without checking growth over time.
Run grep MemTotal /proc/meminfo on the machine you are tuning before you shop for SSD capacity alone. Once you know how much main memory the OS sees, the next question is how a single process carves that space: stack vs heap memory names the two lifetimes programmers argue about in every language forum. When you want to follow one instruction from registers back to the bytes sitting in main memory, how a CPU runs an instruction picks up where this hierarchy diagram stops.
Send this to the friend who calls every storage device memory.

Keep this guide
Filed under Science, Dev explainers
Questions about this guide
Is RAM the same as disk space?
No. OpenStax: the CPU works from main memory (RAM) because disks are far slower. Long-term files live on disk; the working copy for execution is copied into RAM.
Why do laptop ads quote 16 GB of RAM?
That number is main memory size for running programs at once. It is not SSD capacity for photos and downloads.
What happens when RAM fills up?
The OS may page some pages to disk, kill processes, or refuse allocations. Behavior varies by OS and settings. This page stays on the hierarchy picture.
What does random access mean?
Wikipedia: RAM allows reading or writing any address in roughly constant time, unlike sequential media that must scan.
Is RAM volatile?
Ordinary DRAM loses its contents without power. Persistence belongs to disk, flash, or battery-backed devices, not this working-set layer.
Sources
- Wikipedia: Random-access memory, accessed 2026-12-03en.wikipedia.org
- Full Byte Developer: Stack vs heap memoryfullbytedeveloper.com
- Full Byte Developer: How a CPU runs an instructionfullbytedeveloper.com