Androidgrl's Blog About 3D Printing & Tech, by Jamie Kawahara

How Does a Computer Physically Store Binary Code?

Most software engineers know that a computer stores data as binary code, and that binary code consists of 0’s and 1’s. However, the 0’s and 1’s themselves are just abstract symbols that represent real physical states within a computer. In this blog, I will give an overview of these physical states.

Before proceeding I would like to give a brief overview of the mechanisms by which computers store data. Computers use two main mechanisms to store data: memory and storage. Memory is used to temporarily store data that the computer uses while it is actively processing things. Memory is considered “volatile” in that it disappears when the computer is powered-off. Memory is what is commonly referred to when people say “RAM”.

Storage on the other hand is what the computer uses to store long term data like photos, music, and documents. Unlike memory, storage is “non-volatile” and remains after the computer is powered-off. Therefore things like music and documents do not disappear when you power-off your computer. Historically a computer’s storage device has been a hard disk drive or “HDD”. Most computers nowadays however use a solid state drive or “SSD”.

So, we have our three main mechanisms for data storage: “RAM”, “HDD”, and “SSD” and we will now examine how they store binary data.

RAM

A RAM memory chip stores binary data through billions of tiny capacitors. Each capacitor is like a microscopic bucket that holds electrons. When a capacitor is charged, it’s bucket is filled with electrons. When it is not charged, the bucket is empty. Whether or not a capacitor is full or empty determines whether it represents a “0” or “1”. A charged state is considered a “1”, and an un-charged state is considered a “0”. Since each “0” or “1” is considered a “bit” of data, and there are 8 bits in a “byte”, and a typical computer can have 8 gigabytes of memory, then there can be approximately 8X8e+9 or (64 billion) RAM memory cells in a computer! See photo below showing microscopic RAM capacitors. For a sense of scale, the width of the photo is approximately 1/300th the width of a human hair.

dram

As an aside, RAM capacitors are like leaky buckets which continuously leak out the electrons they’re holding. Therefore, when the computer is powered-on there is a constant refilling of the buckets that happens multiple times per second. When the computer is powered-off the buckets drain-out which is why RAM memory is not retained after powering-off.

HDD

A hard disk drive stores binary data through tiny microscopic magnetic lines drawn on a metal disk. A hard disk drive is composed of a spinning metal disk called a “platter” which is coated with a magnetic material. It has a read/write head that has a powerful electromagnet on its tip that is capable of drawing tiny magnetically charged lines on the surface of the platter. See photo below of a typical hard disk drive.

harddrive

If a line is magnetically attractive it is considered a “0”, if it is magnetically repulsive it is considered a “1”. See photo below for a color rendered image showing the magnetic lines on an HDD platter. The width of the photo is about 1/10 the width of a human hair.

magnetic

A common misconception is that household magnets placed near an HDD can cause memory loss through disrupting the magnetic line patterns. This is false since most household magnets are not powerful enough to do this. However, very powerful magnets called “degaussers” are made and used specifically for erasing hard disks by randomizing or scrambling the line patterns.

SDD

A solid state drive stores binary data through billions of tiny transistors. Each transistor can either exist in a charged or un-charged state. A charged state is considered a “0”, and an un-charged state a “1”. Unlike RAM capacitors, SSD transistors are designed to hold their charge after the computer is powered-off. Therefore, data is not lost after powering-off. Below is a cross section of three “memory cell” transistors. The one in the center has a charged state and is considered a “0”, while the one to the right has an un-charged state and is considered a “1”. The width of the photo is approximately 1/300th the width of a human hair.

ssd

In summary, the 0’s and 1’s of binary code are abstract symbols which represent real physical states within a computer. For RAM it is the electric charge inside tiny capacitors, for HDD’s it is the magnetic charge of tiny lines, for SSD’s it is the electric charge inside tiny transistors.