How Memory Works
Memory Fundamentals · Memory & Systems track
3 min read
In this module
Data Needs a Place to Live
Every running programme needs somewhere to keep its data — the variables it's juggling, the instructions it's running, the pixels it's pushing to the screen. That somewhere is computer memory. Drill down to the bottom and memory is a vast grid of tiny storage cells, each holding one bit (0 or 1). Bundle eight cells and you get a byte, which is the smallest unit memory hands out an address for.
Volatile vs. Non-Volatile
Memory comes in two broad categories based on what happens when the power goes out:
| Type | Keeps data without power? | Examples |
|---|---|---|
| Volatile | No - data disappears | RAM (DRAM, SRAM) |
| Non-volatile | Yes - data persists | SSD, HDD, Flash, ROM |
Programmes execute in volatile memory because it's fast. Files live on non-volatile storage because that storage survives reboots. The OS shuttles data from non-volatile storage into RAM whenever you open a programme.
Volatile memory (like RAM) loses its contents when power is removed. Non-volatile memory (like SSDs and flash drives) retains data even without power. Programs execute from volatile memory because it is orders of magnitude faster.
How Data Is Stored Physically
In modern DRAM each bit is an electrical charge sitting in a microscopic capacitor. Charged capacitor: 1. Discharged: 0. Billions of them fit on a single chip. The awkward bit is that capacitors leak charge as time passes, so the memory controller has to refresh them before the charge fades. Every row gets rewritten within a fixed window (64 ms is the classic DDR figure), which means the controller fires off thousands of refresh commands a second, each topping up a slice of rows, just to stop the data from quietly dissolving.
The visualiser below is one DRAM cell: a transistor acting as a gate and a capacitor holding the bit. Press Leak Charge a few times and watch the charge drain until the cell warns that it needs a refresh, then press Refresh to top it back up. The real thing leaks over milliseconds, not button presses. You can also switch to SRAM, which holds its bit in a loop of transistors and has nothing to leak.
Memory Cell Operation
The 1T1C DRAM cell stores a bit as charge on a tiny capacitor. Reading is destructive: asserting the word line shares the capacitor's charge with the bit line, draining the cell. The sense amplifier detects the voltage change and rewrites the value. DRAM must be refreshed every 64 ms to prevent data loss from charge leakage.
Memory Addresses
Every byte in memory carries a unique numeric address, starting at 0 and climbing upward. When the CPU wants to read or write, it puts the target address on the address bus and the memory system either coughs up the byte at that location or stores a new value there. Picture memory as an enormous block of flats with every door numbered — the address tells you exactly which flat to knock at.
That's what makes RAM "random access". The CPU can leap directly to any address without trudging past everything in between, which is what sets it apart from older sequential media like magnetic tape.