eli5 how does RAM work?

218 views

So as far as I understand Random Access Memory lets us access any stored in it data regardless where it’s stored and with the same speed.

I just don’t understand what makes that physically possible. Data is being transfered through electrons at approximately the speed of light through the wires. But how do you connect the wires to access all of the data everywhere in RAM at the same time?
Is the data being broken down into bits over all the RAM units – making the data collection process longer as you have to gather all the data particles or is there something I’m missing.

If I got any of my facts wrong feel free to correct me.

In: 7

7 Answers

Anonymous 0 Comments

RAM has cells. A cell is a “box” where you can have 1 or 0. To read a bit from RAM (or any other electronic memory) you first send an address. The number of bit you want to read. Then the memory chip responds with either 1 or 0.

To make things faster, bits are transferred in bulk, so, you don’t exactly read 1 bit, you read like 64 bits at once, via 64 lines. When it comes to addressing, you also give the word (a packet, like 64-bit packet) address. So at the address 0 you have first 64 bits, at 1 you have next 64 bits and so on.

Then how PHYSICALY the memory knows whether it’s 1 or 0 in the “box”?

It depends. If you’re asking about RAM in your PC, it’s DRAM – that stands for dynamic RAM. It means, that it can store information for a very short time measured in nanoseconds. If you want that memory to keep the data for a longer period, you need to refresh it.

Now – how does it work? A single cell, our “box” is a capacitor. Physically there are 2 conductors (pieces of metal) with an insulator between them. When you connect a voltage to those tiny pieces of metal, they become charged. So the voltage stays there for a little while, before it is discharged. So when it’s charged – you can assume you have 1. When discharged, no voltage, then it’s 0. Now when it’s discharged? When you READ it. You connect something to test if it’s charged, but then it’s getting discharged at the same time. That’s why you need to write after each read. You read 1, (was charged), so you recharge the cell again. Then again, the cells will discharge themselves because the insulator between the conductor is not perfect, and the charge is very small. That’s the reason the data in RAM is lost when you disconnect the power.

So, now you know why is there something like refresh, and refresh rate in DRAM. And why everything gets deleted when you shut the power off.

Now – you need to access a specific cell. How this is done? Similar like with the post office. Lets say you have an address on the envelope. You have a country, street address, postal code, and specific recipient name. The post office is responsible for “decoding” the address. First the mail is transported to another country, then to the destination city, then the appropriate post office in the city, then carried by a mailman to the specific address. In computer RAM – the address is first decoded by the computer hardware to be directed into specific RAM bank, then, on the RAM board to the specific chip, then in the chip to the specific cells.

In RAM you have also specify if you want read or write the data. That’s just one wire that either is set to 1 (some voltage) or 0 (no voltage).

Now in real world DRAM it’s all a bit more complex. The principle of operation is however roughly the same as I described. Instead of capacitors you have MOSFET transistors that happen to be the capacitors as well. Why transistors? It turns out they are just easier to produce and use in big, densely packed chips. The addressing is a bit more complex, also, modern RAM memory use a bunch of tricks to speed up the transfer.

TL;DR – DRAM consists of many small cells that can be charged and discharged. When they are charged, you read 1, when discharged you read 0. To access a specific cell you have to provide the cell number – the address. After reading each cell you have to write it again if it’s 1, because it gets discharged on reading. You have to read and write that kind of memory all the time, otherwise all cells will discharge and you lose data. To achieve that you have something called a memory controller doing just that.

You are viewing 1 out of 7 answers, click here to view all answers.