What is RAM? You need it so your computer runs

Alexis Wilke's picture

Memory DrawersAs I mentioned in an early post, I will also teach my readers how computers work. Remember that Snap! Websites needs all of that to work... and I hope to make the information accessible to everyone. Don't forget that you can hover your mouse over abbreviations and acronyms to get their full definition. There is also a link to my Glossary at the bottom of each post.

All computers require some kind of memory to run. A computer that always does exactly the same task may use what we call ROM or Read-Only Memory, although the processor will still make use of RAM or Random Access Memory for its registers. In other words, all computers need to have a certain amount of RAM in order to function.

So, what is RAM?

Abstraction

Programmers view memory in an abstract way: a set of drawers where they can store a number from 0 to 255.

Those numbers are called bytes. The range for these numbers was not chosen randomly. It represents 256 numbers which is 2 power 8. Although the very first computers would use whatever was required so they would run, early general processors as we know them today would use a specific number of bits: 3, 4 or 6. There were experiments with more bits as well. Today, some DSP run in 16 or 32 bits1.

The reason for choosing 8 bits instead of a little less or a little more, as far as I know, was to accommodate a number from -100 to +100. To represent larger numbers we simply use multiple bytes.

Usage

Since we use electricity to run computers, you certainly knew that electricity was involved. Memory itself is an electronic device and it transmits its state using an electric signal. The signal either represents a 0 or a 1. In many cases (but not always) a 0 is represented by a certain voltage such as 0.1 Volt and a 1 is represented by ground (or zero volt.) Yes, it's often inverted!

To transmit the data inside a computer we therefore use wires. As of today, it is a lot faster than waves2.

The computer has a clock device and at each tick a zero or a one is sent from the memory to the processor and vice versa3.

Processors

Older processors would immediately process the information received from the memory device. Today all processors have caches. These allow the loading of memory data early on and in general makes computers run a lot faster. Still, older processors would also store the memory data in intermediate buffers before processing it. These buffers use the same devices as RAM.

Processors are automatons. They view the numbers from the memory as instructions or data. The instructions tell them how to process the data. All those numbers are what programmers magically generate to feed to the processor and get you Twitter, Facebook, YouTube, and Snap! Websites, oh and Google too.

How does RAM Work?

SMD CapacitorsRAM used several different electronic mechanism throughout time4. Today we use miniature capacitors. A capacitor is an electric field that you can change with a simple electric pulse. It is very easy to build and very easy to run5.

I won't enter in the details of the physics of a capacitor, just know that inside the capacitor you have two plates that do not touch each others. In other words, no electricity goes straight from one side to the other. Instead it uses magnetism. That explains why magnets and computers are not friends. Anyway... that space can be charged with energy or not. That represents the two states necessary to create one bit of data.

So now you know that to create one byte, you need 8 capacitors6. To create 1Mb of memory, you need... 8,388,608 capacitors. If you have a computer with 4Mb of RAM, just for the RAM you have over 33.5 million capacitors. Large servers run with 192Mb of RAM...

Did you know?

Are memory transfers done in parallel?

In modern computers, the RAM works... serially! Yes. This means data is transmitted one bit at a time. This sounds very counter intuitive, doesn't it?

For over 20 years we used parallel devices to transfer the many memory bits between the RAM and the CPU. The fact is that properly synchronizing the electric signals of even an 8bit parallel connector actually takes more time than sending the same amount of bits serially! This is why Hard Drives now use much smaller cables and are called SATA drives.

Now, inside processors data is transferred in parallel.

  • 1. DSPs are used to very quickly process data such as compressing audio to an MP3 or an image to a JPEG in real time. They are not adapted to general purpose computer work. A GPU also has such processing capabilities and may run with 256 bits of data on each clock tick.
  • 2. He! He! No! Electricity in a wire moves at the same speed as a wave. But the wave does not carry data with as much precision and thus more error corrections are needed to send the same amount of data hence the slowness.
  • 3. Note that when you have multiple memory sticks, more bits can be transferred on a clock tick. But this is the basic principal.
  • 4. The first bit ever saved electronically was in 1946 or 1947 by Williams and Kilbur who used a tube, then it evolved to magnetic core memory before the capacitor memory we use today.
  • 5. Although the miniaturization is more and more complex as we're getting really close to the atomic level and thus start seeing weird effects due to what we call quantum physics.
  • 6. Really, one memory cell uses 2 capacitors and 6 transistors...