Computer Architecture book cover

Your technical library

Computer Architecture

13 modules · 64 topics

About this book
Concepts · Computer Architecture

Computer Architecture

This course teaches what the processor underneath your code actually does — how a line of Python becomes instructions, how a chip made of switches executes them, why the same loop runs ten times faster when its data is sorted or laid out in an array, why adding cores stopped being free, and why a laptop still starts up pretending to be a 1978 microprocessor — so that you can read a profile or a disassembly, reason about performance with numbers instead of folklore, and understand the hardware the operating system is built to share. It is written for any software engineer who was never taught what the machine does with their code. No hardware background is assumed, and nothing is used before the topic that teaches it. It builds on three other courses on this site: System Design (the latency numbers and Amdahl's law it assumes), Data Structures (counting operations as a cost) and, where logic or expectation appears, Mathematics. It goes underneath the Operating Systems course: where that course teaches a piece of hardware as the kernel and your programs meet it — the stack, caches, coherence, memory ordering, speculation — this course shows how the hardware is built to behave that way, and links back to the lesson where it is applied. It is the recommended predecessor of Operating Systems: that course's lessons keep the programmer's view and link the topic here that builds each mechanism, so nothing below assumes you have read Operating Systems first.

The course runs top-down first, then bottom-up. The computer from the top draws the map: the levels of abstraction from transistors to applications, the stored-program design every computer since 1945 follows, the journey from source code through assembly and machine code into RAM — with the compiler and the operating system placed on the map — and the one equation that says what makes a program fast. The language of bits shows how numbers, signs and bytes are encoded. The instruction set teaches the contract between software and hardware on RISC-V — arithmetic, memory, branches, function calls and encodings — and ends by reading real compiler output. Then the course goes underneath the contract and builds a machine that honours it: logic and arithmetic circuits from transistors to adders, state and memory cells from flip-flops to DRAM, and building a processor from those parts, including the microcode that ran the 8086.

The next modules make that processor fast. Pipelining overlaps instructions and deals with the hazards that follow, including branch prediction and exceptions caught mid-flight; instruction-level parallelism issues several instructions per cycle, out of order and speculatively, and shares one core between two threads. The memory hierarchy shows why memory, not arithmetic, usually decides speed: caches, their misses, prefetching and DRAM, closing with the processor's own performance counters, which tell you which of the course's stalls a real program is hitting. Multicore explains why chips grew cores instead of gigahertz and what keeps their caches and memory consistent. Data parallelism covers SIMD instructions and GPUs. The x86 lineage follows the 8086's segments, modes and variable-length instructions into today's x86-64 cores, and buses, devices and power-on connects the processor to the outside world, follows it to the moment firmware hands the machine to an operating system, and closes by comparing a microcontroller such as an Arduino, which runs one program with no operating system, with a Raspberry Pi or laptop, which boots one — where the Operating Systems course begins. Along the way each topic says what it inherits, what it leaves open, who designed the idea and when, and how it shows up in decisions engineers make.

64 topics across 13 modules, in dependency order.

64 of 64 topics are authored. Read in dependency order. Each topic opens with the problem it inherits and closes with what it leaves open. Planned lessons are labelled and excluded from progress; references cover authored material.

Course map

Read at your own pace. Each topic is one continuous page; mark it done as you finish.

Start with 01.1 · Levels of abstraction: from applications down to transistorsReview what you have finished