How computers work — Part 1

CPU Architecture Diagram

In this article I will be discussing a few of the components that make up a computer and briefly discuss how they work without being too verbose with information regarding each individual component. Knowing how a computer works can help developers of all levels understand how to write better and more performant software. At the very least this post should give you a good understanding of how a CPU works, what buses are and how your computer handles memory as well as what it is and the different types of memory in your computer


The CPU or Central Processing Unit executes inctructions stored in main memory, at its core is a word-sized storage device also know as a register and a PC (Program Counter)

ALU (Arithmatic/Logic Unit)

The ALU computes new data and address values. Most of the operations that the CPU performs are performed by one or more ALUs, which load and compute new data and address values into input registers.

CU (Control Unit)

The CU tells the ALU what operation to perform on data and the ALU stores the result in an output register. It also moves the data between these registers, the ALU and memory


At any point in time the PC contains the address of some machine-language instruction in main memory


A small amount of storage available as part of the CPU


There are 6 types of memory

Cache memory — generally made up of the L0, L1, L2, and L3 cache of the processor. The Cache memory interacts with the register file and the bus interface on the CPU chip. L1, L2 and L3 cache are also known as static random access memory

Generally the higher the number i.e. L2 and L3 the further away from the processor the memory is and thus the slower it is,

Main memory — also known as DRAM or Dynamic Random Access memory this is usually connected to your motherboard via a RAM stick. Main memory holds data known as disk blocks retrieved from the local disks.

Local secondary storage — also known as hard drives, hold files retrieved from disks on a remote network server via the internet or files that come preinstalled with your computers OS (Operating System)

Remote secondary storage — (distributed file systems, Web Servers, etc) — this is basically everything you see on the internet, and some stuff that you don’t see.


Buses are basically electrical conduits that transfer bytes of data back and forth between system components. Buses typically carry fixed-sized chunks of bytes known as words. The word size is an integral and fundamental system parameter that varies across systems. Today most machines have word sizes of 8 bytes (64 bits) or 4 bytes (32 bits)

A few notable buses are as follows:

I/O bus (peripheral bus)

The I/O bus allows a number of I/O devices to be connected in parallel, this bus is the data pathway that connects the peripheral devices to the CPU. Each I/O device is connected the the I/O bus by either a controller or adapter

System Bus (Crossbar Switch)

The System Bus consists of the Control Bus, the Address Bus and the Data Bus in single CPU systems but in many modern systems, we have what is called an SMP — Symmetric Multiprocessor System. In the SMP architecture the Crossbar Switch forms an interconnected system of processors that are connected via the crossbar switches.

Data Bus

The data bus handles the transfer of data from the system memory to the chip-set. The wider the data bus the higher its performance, this is because it can allow more data to pass through at the same amount of time. This is called data bandwidth.

Address Bus

The address bus communicates with the system on where specific information can be located or stored when data either enters or leaves the memory. The speed and delays of an action made in a computer system depends greatly on the address bus since it is the entity locating the information. Its width depicts the amount of system memory a processor can read or write into.

I will go into further detail on the ALU, registers, and the CU in part 2.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Inside the shell

Singleton Pattern

CS 373 Spring 2022: Kyle Kamka

LESSON 9 : 9.2 App Settings

Week 11: Coding Period 3

CXL Institute Digital Analytics Minidegree Review 1: Google Tag Manager for Beginners

The Gang of Zero

Writing Elegant Code with Clean Code

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Harwell

Chris Harwell

More from Medium

LeetCode #58: Length of Last Word

Software Engineers: How Do You Stop Deploying Bugs And Causing Incidents?

Know The Time Complexity Of Your Programming Code

Pair Programming — Friend or Foe