Transcript
This memory stick holds sixteen gigabytes: about seventeen billion bytes. Every one of them has its own address, and the processor can reach any of them in roughly a ten-millionth of a second. Today, we look inside.
Last time, a latch stored one bit. Put eight of them in a row, and you can store one byte. Stack the rows, and give each row a number: its address. Row zero, row one, row two, and so on. To pick a row, we use a decoder, the circuit from episode three. Three address bits light exactly one of eight rows. To read, the chosen row puts its bits on the data lines. To write, the data lines push new bits into it. Every extra address bit doubles the rows. Thirty-four bits are enough for seventeen billion addresses.
There are two main ways to build each cell. The first is a tiny loop of two NOT gates, like our latch, plus two switches to connect it. That's six transistors per bit. It's called static RAM, or SRAM. It's very fast, and it keeps its bit as long as the power is on. But six transistors per bit take up a lot of room. So SRAM is used where speed matters most: in small memories inside the processor itself. We'll meet them in the episode on caches.
The second way is much smaller: one transistor, and one tiny capacitor, a little bucket for electric charge. A full bucket is a one. An empty bucket is a zero. The catch: the buckets leak. Left alone, a one would slowly fade into a zero. So the memory reads every row and writes it straight back, every few hundredths of a second, all day long. That's called refreshing. This is dynamic RAM, or DRAM. It's slower than SRAM, but so small and cheap that billions of bits fit on one chip. That's what's on your memory stick.
All of this forgets everything when the power goes off. For data that must survive, there's read-only memory, or ROM, fixed when the chip is made. And there's flash memory, which traps electrons on a tiny insulated island. They stay there for years, with no power at all. Flash is in USB sticks, phones and SSDs. We'll open one up in a later episode.
So: memory is a grid of cells, an address picks a row, SRAM is fast, DRAM is dense, and flash keeps data without power. Our memory is full of numbers. Some of them are data, and some of them are instructions. Next time: how a number can be a command. See you there.
Next episode: how a number becomes a command. Instructions.