How computer memory stores bits
What physically holds a 1 or a 0 inside a chip: the SRAM, DRAM and flash cells, how one cell is picked out of billions, and why each kind has its place.
In 30 seconds
Memory is a grid of tiny cells, each storing one bit. An address selects a row and a column, and so a single cell.
There are three main cell designs. SRAM holds the bit in a loop of six transistors: very fast, but large. DRAM holds it as charge on a capacitor: small, but it leaks and must be refreshed. Flash traps electrons behind an insulator: slow to write, but dense.
SRAM and DRAM forget when the power goes off. Flash remembers, which is why it is used for storage.
How computer memory stores bits, step by step
Simplified: real arrays have sense amplifiers and far more rows and columns, flash cells are wired in long chains, and many modern flash cells trap charge in a different layer and store several bits each.
- Step 1: A grid of one-bit cells. Computer memory is an enormous grid of identical cells, and each cell holds a single bit: 0 or 1. Everything a computer remembers, from a photo to a running program, is spread across these cells. What differs between kinds of memory is how one cell is built.
- Step 2: Addressing one cell. Each cell has a numbered position, its address. Half of the address bits go to a row decoder, which switches on one word line and wakes a whole row. The cells in that row put their bits on the vertical bit lines, and the other half of the address picks which bit line to pass on.
- Step 3: SRAM: a loop that holds. Static RAM stores the bit in two inverters (NOT gates) wired in a ring. One outputs 1, which makes the other output 0, which keeps the first at 1. Each inverter is two transistors, and two more connect the cell to its bit lines when the word line is on: six in all. Fast, but bulky.
- Step 4: DRAM: charge in a bucket. Dynamic RAM keeps the bit as electric charge on a tiny capacitor, behind one transistor. Charged means 1, empty means 0. The cell is very small, but the charge leaks away and reading it drains it too, so the chip rewrites every cell many times a second. That is the refresh.
- Step 5: Flash: trapped electrons. A flash cell is one transistor with an extra layer, the floating gate, wrapped in insulator. A strong voltage pushes electrons onto it, and there they stay. Their charge changes whether the transistor conducts, which is how the bit is read. Writing is slow and gradually wears the insulator out.
- Step 6: Speed against density. The three designs trade speed for size. SRAM answers in about a nanosecond (a billionth of a second) but needs six transistors per bit. DRAM is a little slower and far denser. Flash packs in the most bits per chip and is the cheapest per bit, but it is much slower, above all when writing.
- Step 7: When the power goes off. Cut the power and an SRAM loop stops holding, and a DRAM capacitor drains with nothing to refresh it: both are volatile. Flash keeps its trapped electrons, so it is non-volatile. A computer therefore keeps files and programs in flash and works on copies of them in RAM.
Try it yourself
Learn this first
- Binary numbersCounting with only 0 and 1, and why that suits a machine built from switches. Beginner
- TransistorsA small signal controls a large current: the switch and amplifier behind every chip. Beginner
- Logic gates (AND, OR, NOT, XOR)NOT, AND, OR and XOR as truth tables, and how NAND gates alone can build them all. Beginner
Learn next
- Cache lines and cache missesMemory arrives in 64-byte lines, so neighbouring data is fast and scattered data is slow. Intermediate
- Virtual memoryEvery process gets its own addresses, mapped page by page onto shared RAM and disk. Intermediate
- How chips are made (photolithography)Printing billions of transistors with light, one layer at a time. Advanced
Spotted a mistake on this page?