top of page

How the Hell does a Computer Work?

Updated: Aug 13, 2023

So, we learned about the parts of a computer and what it needs to run. You can check that article out here! Now it is time to learn how a computer and its parts work, and boy is it interesting! Let’s dive right in! The bare bones explanation is that computers work via electricity. By allowing electricity to either flow or not flow through switches that control this flow a computer can get the information it needs to run. The presence of electricity flowing is detected as a 1 and the absence of electricity flowing is detected as a 0. The 1 and 0 are called binary digits. Sound familiar? I briefly touched on the binary system in this article here! Through a series of 1s and 0s, instructions can be fed to a computer to tell it to do things- this is where programming comes in. Although we no longer write code with just binary digits, we did when the first computers were created. Today, the code we write is ultimately translated by the computer into the 1s and 0s that it needs to run. Essentially by controlling the flow of electricity through 1s and 0s, the computer can be made to do many wonderful things!


Computers began to be created in earnest around the 1940s and into the 1950s. When these computers were first invented, they were massive and some could take up an entire room! Since then, computers have evolved quickly and in a very short time. The first computers used clunky technology, such as vacuum tubes and relays. These worked as an electronic switch that could be physically turned on and off to allow the flow of electricity. A vacuum tube was a tube that had no air or other gasses inside it, hence, a vacuum. It had a cathode on one side and an anode on the other side and allowed electricity to flow from the cathode to the anode. Thus, with electricity flowing through the vacuum tube, the early computers got their 1 and by having no electricity flow, they got their 0.


But vacuum tubes and relays were incredibly bulky and soon gave way to transistors around the late 1950s and into the 1960s. A transistor was made from a semiconducting material, such as germanium or silicon (perhaps that’s why Silicon Valley got its name?). Transistors are a bit more complicated to understand, so just know that they are made of three layers called the emitter, the base, and the collector, and that electricity can flow or not flow through them to create the 1s and 0s. Transistors were much smaller than vacuum tubes, could operate a lot faster, and had lower power requirements.


Eventually transistors began to shrink even more in the 1960s and soon were able to fit on an integrated circuit. The integrated circuit was revolutionary and allowed other miniaturized electrical components to fit all in one space. These further increased computing power, decreased size, and decreased electricity consumption. As the electrical components continued to shrink smaller and smaller, another revolutionary component was created- the microprocessor. This was created in the early 1970s and contains an entire central processing unit (CPU) with its various electrical and other components on a single integrated circuit. The CPU controls almost everything on a computer and is where a lot of the execution takes place for running programs. This is where the computer reads the 1s and 0s, the presence or absence of electricity. And soon, we will be able to communicate with the computer, and give it our own unique set of instructions and have it do cool things through programming!


Now before we move on to learning how to do just that, I want to share how memory works in a computer- how a hard drive works, how a solid-state drive works, and how non-volatile and volatile memory works. Let’s start with the oldie, but goodie- the hard disk drive, or hard drive, which was introduced in the mid 1950s. Hard drives were by far the most fascinating for me to learn about. While I had known that computers had hard drives, I never learned how they worked until I began my journey into computer science. Hard drives work using something pretty cool- magnets! And the reason you might hear a hard drive making noise is because it is actually a moving part! The hard drive kind of looks like a CD- a very weird-looking and tiny CD. But the circular CD-looking part is called a platter and the “middle” of the CD where the hole would be is a smaller raised circle called a spindle. This holds the platter in place and allows it to spin around. The platter is usually made out of a metal or glass, and is coated on both sides in a ferromagnetic material. This ferromagnetic material can be iron, cobalt, nickel, or an alloy.


Information is encoded onto the platter using the ferromagnetic material and its associated magnetic fields. It is done using a write head, which does exactly as its name describes. The write head, which has an electromagnet on it, is an arm that extends out over the platter and can access the whole platter as it spins. The atoms in the ferromagnetic material are divided into small regions called domains, and as the write head passes over the domain it needs, it can change the magnetic field of the atoms and encode information, or data, onto it (seriously- isn’t that the coolest thing ever?? How do they come up with this stuff?). In order to read the data, you guessed it, a read head is used. This is separate from the write head and is able to detect the direction of the magnetism, convert it into an electrical signal, and thus read the data from the hard drive.


Now, don’t ask me how all of this works on a deeper level, as there are some parts I didn’t mention as seen in the image below, but I will leave that for you to research yourself! Now, the magic about all of this complicated magnetic stuff is that it retains its data very well. Hard drives store non-volatile memory- or memory that can’t be lost when the power turns off. This is why we can shut down computers or how laptops can completely die and work fine after recharging the battery. It just astounds me that the hard drive (pictured below) or other storage types that have non-volatile memory can hold onto that memory without power.


Diagram of a hard drive!

Source: https://commons.wikimedia.org/wiki/File:Hard_drive-en.svg (I, Surachit, CC BY-SA 3.0 <http://creativecommons.org/licenses/by-sa/3.0/>, via Wikimedia)


So now that we have learned about how cool hard drives are, let’s take a look at its upgraded sibling, the solid-state drive. Already, there is a hint in its name as to what it looks like. Unlike the hard drive, with its moving parts, the solid-state drive is one solid hunk of a non-moving piece. Now, this one is a bit more complicated, so I won’t go into too much detail about how it works. Unlike the hard drive, there is no magnetism involved in a solid-state drive. It uses integrated electronic circuits to store its data. These integrated circuits use something called flash memory to retain its memory, even with no power. Flash memory is a bit newer, having been created in the 1980s, and works by storing information in memory cells. These memory cells are made from floating-gate transistors, which is a special type of transistor, but I won’t go into much detail on those here.


I won’t dive too much into how reading and writing works as it is a bit complicated for even me to understand, but it involves using electricity to write the data and read what is stored in the memory cell. So while the hard drive uses magnets to store data, the solid-state drives use electricity. Both of those drives have non-volatile memory meaning that what is stored in the drive cannot be erased even when the power is off or the battery dies. The opposite of this is volatile memory. This is memory that requires power in order to work. While it cannot remain once power is cut, it is a lot faster to access while non-volatile memory is not as fast to access. One word that might come to mind when thinking of volatile memory is RAM- Random Access Memory. RAM is connected to the CPU and can allow it to access data very quickly- in nanoseconds. This provides very fast operating speeds for the computer. The computer uses both these non-volatile and volatile memory types to either store data permanently or to access memory quickly for fast computing.


There is still a lot that I have not talked about, such as clock speed, ROM, BIOS, operating systems, and so on. While those and much more are important to how a computer works, I just wanted to touch on the main concepts of the computer that are most concerned with programming. I will leave the deeper dive into all of that to you, your curious imagination, and a generous search engine! But knowing that a computer works via electricity and uses 1s and 0s will help to understand how coding has evolved over the years. Now, granted, this information is not absolutely necessary to learn how to code (and ultimately do the mathematical coding to analyze astronomical data and thus speak to the Universe), but I always love taking the deep dive into the things I am studying and sharing those things I learn. I find it helps me when I can understand the why of things and not just do the rote memorization of something. Next, we will learn all about computer programming and what it is and gain the tools and skills needed to converse with the Universe!


Resources



Recent Posts

See All

Comments


bottom of page