This article aims to explain what Arithmetic Logic Unit (ALU), Central Processing Unit (CPU), Random Access Memory (RAM), Read-Only Memory (ROM) and the hard disk are, in a very simple manner. If you have heard some of these terms before and you don't understand what they are, then you are in luck. This article is for you.
These are the electrical circuits that many of the electronic devices we use daily have, but we rarely know what they do, let alone how they work.
The story starts with tiny cables that carry electricity. It has two states it can be in, either there is electricity on a wire, or there is not. We can call these states on/off, 1/0, white/black, yes/no, or James/Emma. What we call them doesn't matter, not actually, but they are more commonly called 1 and 0. Each 1 or 0 is called a "bit".
Now, a bit can only hold a single piece of information, it can be an answer to a yes/no question. Think of it as a sign on your hand, with 2 sides, on one side there is "yes", on the other side there is "no". For example, if somebody asks you "have you eaten lunch?", you can answer with a bit. If you have eaten your lunch, you can show the side with 1, if you haven't, you can show 0. In this case, you got away with your tiny bit.
But what if you are being asked something else, like your name? You have a single bit, how are you going to answer the question?
Here comes the concept of byte. A byte is 8 bits (0's or 1's) stuck together. As a bit can either be 1 or 0, there is 2⁸ possible information it can hold! Thankfully somebody encoded the alphabet already, so each letter that symbolizes your name has a byte representing it. And your parents wrote down the bytes that encode your name to a paper and you always carry it in your pocket. This has been your name since the day you were born, your manufacturers have given it to you.
Now, what if you were asked how many calories you would get from 3 fried eggs. Gosh, now you have to take the calorie of one single egg, multiply it by 3, keep the result of the multiplication and add the calories of the added oil, keep the final result somewhere. Cumbersome, right?
There are tiny circuits made from basic logic gates that do certain operations. Simplified version: You have input wires, and you have an output wire. These circuits are wires that are connected in such ways that they create a certain output. With the same inputs they always create the same output, they are consistent and reliable. All the basic operations (the building blocks of bigger operations) have individual circuits. If we go back to the fried eggs example, two main arithmetic operations will lead you to your final answer: addition and multiplication.
If you combine all the wires that do basic arithmetic operations that a computer can do on a single chip, it becomes an Arithmetic Logic Unit. Now you can combine simple operations to find answers to life's complicated problems.
CPU is the part that executes the instructions of a program.
CPU has 3 important parts:
We have talked about ALU, but what the heck are the other two? Well, the control unit is the part that says, "multiply this with that and then add this to the result of that". Which means it controls which operations are going to be done in which order.
Registers are byte-sized memory cells, which contain the results of different operations. Back to the fried egg example, you need to multiply the calories of a single egg with 3, then add the calorie of the oil to get to the final amount of calories. To do that, you need to store the result of the multiplication first, so you dump that value to a register, and for the final addition you take that value as an input.
Now, if you have ever bought a laptop by yourself in the last 5 years, you have probably seen 2/4/6/8-core processors. The processor is the name of the chip that is responsible for executing instructions, but it can contain multiple CPU's, that are called cores. So if you are working with a 6-core processor, this means your processor has 6 CPU's, which means you can calculate the total calories of 6 different dishes at the same time.
Let's define RAM, ROM, and hard disc first, and then talk about why we need all these different ways of keeping data.
Random Access Memory is a collection of registers. It is also called by other names, such as read-write memory, or primary memory. When we are running a program, CPU requires certain data to run it properly and this is where that data is kept. It is volatile (temporary), meaning the data will get lost when the power is off.
ROM stores crucial information that is essential for the computer to work properly, such as a program essential to boot the computer. It is nonvolatile (permanent), meaning the data kept in ROM is not lost when the power source is gone. The data ROM holds is either unchangeable or requires a special operation to change.
Hard disks were invented around the 1950s and their working principles are very similar to a cassette tape. Both use the same magnetic recording techniques to store and retrieve digital data, as well as other older technologies such as CDs, VCRs, floppy disks.
Let's start with a cassette tape and then compare it to hard disks.
If you look inside a cassette tape, you'll see a very simple device. There is a looong piece of tape (in fact, for a recording that's 90 minutes long, the tape is 443 feet -135 meters- long), there are 2 rollers that help you roll that long tape, two halves of the plastic outer shell to keep everything together, and a small felt pad that acts as a backstop for the playback head.
When we dissect this long tape, we can see that it's a thin plastic coated with ferric oxide (Fe₂O₃) powder that was mixed with a binder for it to attach to the plastic base. (Yes it is like iron oxide but slightly different, as iron oxide is FeO.) Ferric oxide is a ferromagnetic material, if you expose it to a magnetic field it will be permanently magnetized by the magnetic field. Still, you can erase the tape, or make a recording top of it, so it is pretty much reusable. To record audio, you use something called "a tape recorder" which is a simple device that has a very tiny, rounded electromagnet that applies magnetic flux to the ferric oxide on the tape. It also has an iron core wrapped with a wire, and this is where the audio signal is sent to create the magnetic field. And when you are playing a recorded tape, the motion of the tape creates a varying magnetic field that becomes a signal in the coil, and this signal is amplified for the speakers.
Now we can go back to the hard disk. In a hard disk, the material used for the magnetic recording is not a plastic tape, but an aluminum or glass disk. The information encoded in a hard disk takes a much smaller space when compared to a cassette tape, this allows storing a lot more information in a smaller space. The read/write head of the hard disk never touches the disk (in a cassette, the head touches the tape directly), but mainly flies over it, and it moves way faster. Moreover, the aluminum/glass disk stands on top of a platter that can spin, so the information can be accessed a lot faster.
Now that we know what these things are and what they are responsible for, let's try to understand how they work together.
You need your CPU to do the simple tasks you need. To do that, CPU needs to use some memory, but it if it constantly reached out to permanent storage for every bit of information, it would be a slow process. So to make it faster, people who designed computers made temporary storage areas like RAM and caches. They are positioned closer to the CPU and it is faster to retrieve information from them.
Let's go through what happens when you open your computer:
Note: You can see a "virtual memory" section under RAM in the pyramid. Virtual memory is a method that is used for adding memory to RAM beyond its capacity, as it is limited and expensive memory space. As a CPU can access one memory place at a time, most of the RAM is unused, so if you locate the spaces that have been unused for some time and move them to hard disk temporarily, there will be some space left in your RAM for acute usage. And as hard disk space is cheaper when compared to RAM, it is a cheaper method of expanding your RAM, without physically doing it.
The simplest unit of human memory is the specialized cells that are called neurons. A human brain contains about one billion neurons. The most amazing thing about neurons is their ability to connect. Each neuron makes about 1,000 connections to other neurons. These connection points are named synapses. Synapses are very diverse, each of them is quite different from one another.
Synaptic plasticity is how the neurons adapt to new information, their ability to modify their connections, and re-wire themselves. An analogy I like for explaining synaptic plasticity is the forest trail analogy. The more people walk from a certain path, the more it becomes easier to walk. Others that are going to pass from that area will most definitely use the easier one (heck, there might be more snakes and ticks at the areas that people don't walk), and as more and more people will use it, it will become more of a trail. This is also how synaptic plasticity works, "neurons that fire together, wire together". The more you visit a certain memory, the harder it will be to forget.
Humans have many types of memories, just like computers- but actually pretty different. Human memories can be classified into two big groups: Declarative and Procedural (also called non-declarative). The memories of facts and events are classified under declarative memory. Any question you ask your friend that starts with "oh do you remember the day we" fall under this category. Anything other than facts and events, such as skills and habits (walking down the stairs, riding a bicycle, etc.), muscle memory (you know how much power is enough when lifting a cup of water without even thinking about it, how awesome is that?) and emotional memory falls under procedural memory. Procedural memory is hard to forget, and mostly you don't even remember learning these. Declarative memory, on the other hand, is very easy to forget and you have to fight to keep them. There is no clear limit to the number of declarative memories a brain can store because the brain doesn't work like electric circuits. A neuron makes many synapses and can be fired on multiple occasions.
Now, from our daily experiences of being a human, we know that some memories do last longer than the others. We can classify our declarative memories (memories of facts and events) as short-term and long-term memories. Short-term memories are vulnerable in terms of being corrupted, as they can be erased by head trauma or electroconvulsive therapy (shortened as ECT, which is some sort of a restart procedure for neurons, mainly used in psychiatric diseases). Short-term memories that go through a procedure called consolidation become long-term memories. Memory consolidation happens with revisiting that memory again and again, so the related neurons will fire and the synapses in between have structural changes that make them easier to get fired. Long-term memories are harder to destroy, but still possible. Illnesses such as brain tumors, severe epileptic seizures, strokes, brain infections, drug and alcohol misuse, etc. might corrupt long-term memories.
Now you have seen how the human brain stores anything. Very organic, very unpredictable.
Computer memory, on the other hand, consists of volatile, short-term-like memory (like RAM), and non-volatile long-term-like memory (like a hard disk). Computer memory doesn't have an equivalent of declarative and non-declarative memory as it lacks the muscles and emotional structures, so we can say it only has a declarative memory. The memory of a computer is also addressable, if you know where you store a data (hopefully you do), you can go exactly to that spot and read it over and over again. (You don't know the exact spot where a human brain stores something, modern neuroscience only knows the area the memory is probably stored in). Computer memory is also very dependable, if you don't explicitly change the data there (except for the physical injuries to the circuits of course), it won't easily be corrupted. A human memory, on the other hand, can be altered every time that it is remembered, as you remember the last version of the memory you told, but not the original one. Human memory of an event can grow less precise with each retrieval, even to the point where it is completely false. If you're intrested in this subject, check out this article.
So, you should stop bullying yourself when you can't remember stuff. You're not a computer, you are a human, and everything is fine. That's how we operate. And we still rock.