Computer Architecture

How the hardware runs your code.

Every language runs on the same basic machine: a CPU, registers, caches and RAM. Knowing how they work explains practical things like why arrays are usually faster than linked lists and what a cache miss costs.

  • Advanced
  • 7 lessons
  • Runs in your browser
Not started yet
Start lesson 1

Lessons

  1. Bits, Bytes & BinaryEverything a computer stores, from numbers to text to images, is made of bits that are either 0 or 1. You'll learn binary, hexadecimal and how negative numbers and text are represented.
  2. The CPU: Fetch, Decode, ExecuteA CPU repeats one loop billions of times per second: fetch the next instruction, decode it, execute it. You'll see what instructions look like and how modern CPUs speed this loop up.
  3. The Memory Hierarchy & CachesReading from RAM takes around 200 CPU cycles, so CPUs keep copies of recently used memory in small, fast caches. You'll learn how caches work and how to write code that uses them well.
  4. From Source Code to Machine CodeSource code reaches the CPU in one of three ways: compiled ahead of time, compiled just in time, or interpreted. You'll learn how each works and what it means for performance.
  5. Cores, Threads & ParallelismAround 2005 single cores stopped getting much faster, so chips gained more cores instead. You'll learn how cores and threads work and why sharing memory between them needs care.
  6. Thinking in NanosecondsIt helps to know roughly how long common operations take. Once you know a RAM access costs ~100ns and a disk read ~100µs, many design decisions become easier.
  7. Architecture CheatsheetThe numbers and mental models worth memorizing, on one page.

Install it on your own computer

This is a concepts track, so there is nothing to install. These optional commands let you look at your own CPU details and at compiled machine code. You do not need this to follow the lessons: the examples run in your browser.

Bash
# See your CPU's details:
# Task Manager -> Performance -> CPU
# or:
wmic cpu get name, numberofcores, maxclockspeed

# Explore compiler output for any C code (no install):
# https://godbolt.org

What people build with Computer Architecture

Learn the basics first, then pick up these tools when a project needs them.

Practical uses

  • Understand how source becomes machine execution
  • Optimize cache and memory behavior
  • Reason about CPU performance and concurrency
  • Design embedded and low-level systems

Projects to try

  1. Logic-gate simulator
  2. 8-bit CPU emulator
  3. Cache simulator
  4. Pipelined processor in HDL

Common tools and packages

Logisim EvolutionRISC-V toolsQEMUVerilatorGTKWaveperfCompiler Explorergem5

Well-known software

RISC-V coresARM processorsx86-64 CPUsApple siliconQEMUFPGA soft cores