How does a computer work?

Josh Smith
7 min readApr 24, 2019

Every single day, almost half of the entire world will use its two billion computers. Some will use it to read the news or browse their favorite social media websites, while others may use it everyday at work. Computers have brought everyone closer together to view large amounts of information at the tip of their fingers. But how does a computer even work?

As a student currently studying software development, I have been asking myself this question more and more everyday. Sure I have some knowledge in a couple programming languages, but I quickly realized I am rather ignorant to how the computer is handling all of these inputs and quickly giving me exactly what I asked for at the speed of light. That curiosity has led me to write this short post and hope to define it for myself.

The main function of a computer was created in the same way the car was first created. We needed a more efficient way to do tedious functions or calculations so we could focus on the larger problems at hand. Today we take them for granted but when the first computer was created it was far slower than the basic calculator on your phone. A computer can be broken up into four major components: input devices, memory, cpu and output devices. Each component could easily drop you into a rabbit hole and I hope this will peak your interest enough to take that journey, but I would like to just define and present a little more understanding without jumping in myself. The image above provides a simple representation of how a computer or information processing system flows data.

Input Devices

It all starts with the input. There are many devices that allow you to pass inputs to the computer. The combination of a keyboard and mouse was one of the most recognizable input devices. The mouse was first created in the 1960’s. It was a box shell with two metal wheels that would roll on the bottom. It has changed greatly since then, but as touch screen and trackpads become more popular, mice used less everyday. The keyboard was adapted directly from the QWERTY typewriter dating back the late 1800’s. Even though the keyboard has definitely changed tactilely, the QWERTY layout has remained and is recognizable by anyone who has touched a computer even if you have never heard of QWERTY. This duo was the foundation of passing information to the computer for most of the early days. Now, input devices have adopted many newcomers such as microphones, bar code scanners, magnetic ink card readers, and many others. Anything used to directly pass information to a computer is a type of input device.

Memory

Memory and CPU’s work together between the input and output. All inputs must be converted before a computer can store or process the data. Think of this in the same way the Javascript engine runs. There are two phases. The first is where the data is converted to something readable for the computer and held in memory(RAM) while it finishes converting the rest of the program. The second time through it will move the data to other processors that can do something or execute it. From the moment you turn your computer on until you turn it off, your computer will be using memory. On the start up phase, it will grab the ROM, our first example of secondary storage. The read only memory is like your DNA. It is the main constituent of the computer. It is usually programmed in during the manufacturing stage and is stored in such a way that you can only read it and cannot be changed in anyway. This is a great example of non-volatile storage which is memory that does not need power to be accessed. This is how you can turn the computer on. The ROM also loads the BIOS or basic input/output system.

Memory is the first big rabbit hole so I will only touch a little on RAM. Basically the RAM stores all current data and machine code being run making it a primary stage device. Because of this, RAM is considered volatile and will require power to run. Easy way to remember the difference is the RAM(Random Access Memory) will not need to run when the computer is off because there is nothing currently being stored. The two types are DRAM and SRAM. Static RAM is the faster of the two where a bit of data is stored using the state of a six transistor memory cell. Dynamic RAM stores a bit of data using a transistor and capacitor pair called a DRAM cell. Either way this device is considered to be a primary storage device because it gives direct access to processors performing tasks with that data.

The most common memory device known is probably the hard drive. This is the largest storage device containing every application, document, picture, or video you have downloaded. Because this stores everything and relies on mechanical components to gather data it is viewed as “slow” but by no means would you ever be able to notice. It is non-volatile and considered a secondary storage device because its data would have to be sent to the RAM to be processed. There are many types of memory and a hierarchy but that rabbit hole is for another day.

Central Processing Unit

The CPU can be broken up into two pieces: the Control Unit and the Processor. I previously mentioned that the CPU and memory work together and that all happens in the Control Unit. It is responsible for directing all traffic. The input devices will pass data into the combinational logic(code converter) which gives instructions to convert the code into binary and then send it into memory. During this process the Control unit sees it come in, grabs instructions stored inside the registers, delivers the instructions to the combinational logic(code converter) to convert the data into binary code. Then it grabbed more instructions from the registers, sends the data back to the combinational logic, it grabs more instructions from the registers, sends those instructions to the combination logic(logical/arithmetic functions), those get executed and the “mutated” data is moved to memory. From this cache or primary memory(RAM), the control unit will tell it to do one of two things; it can then be moved to an output device or be stored in main memory. If it is moved into memory, it will stay until the control needs it again. If it is to be output, it will pass again through the combinational logic(data transmission) and finally passed to an output device. The processor is made up of the register, cache, and the combinational logic. The cache is memory(RAM) that is installed directly on the cpu to hold this data during its “processes”.

Output Devices

The hard part is over. Lastly we have the output devices and I’m sure you can guess what these are. The monitor, GPS, headphones, braille readers, and 3d printers are all output devices. Being only a couple blocks from Wall Street, the infamous stock ticker comes to mind. This device, invented in 1867, would receive stock information through a telephone line and print out stock prices one by one. it got its name from the “tick” it made as it printed out each line. As computers became more popular, especially in business, it quickly shut this technology down after a strong 100 year run. It was someones job to watch the ticker for a certain stock pass that information onto someone who would make a decision. This allowed several stocks to be displayed at once. With a couple features added on, you could see only the stocks you wanted to.

Conclusion

I have barely scratched the surface on how computers work and hope this was enough to spark enough interest to learn more on your own. Computer programming is a large, humbling and exciting topic. The only goal I have with it is to continue learning and forever be curious. I’m sure I have made some mistakes in my explanation and hope someone will drop by and correct them to further my learning and others!

--

--