0.1.5 The CPU β the worker
In one line: the CPU is the only thing that actually does anything β every other part either feeds it instructions or stores its results.
A story β the chip that was meant for a calculator
In 1969 a Japanese company called Busicom asked Intel β then a tiny startup β to design twelve custom chips for a desktop calculator. Intel had a young engineer named Ted Hoff who looked at the spec, sighed, and said: βwhat if instead we build one general-purpose chip that runs calculator software?β
That chip β the Intel 4004 β shipped in 1971. It had 2,300 transistors, ran at 740 kHz, and could do roughly 92,000 instructions per second. It cost $200. Busicom got their calculator. Intel got the future.
Todayβs Apple M3 Max has 92 billion transistors running at 4 GHz β about 40 million times faster than the 4004, and 40 million times more transistors. But the idea is identical. A CPU is a single chip that does one thing very well: it follows instructions, one after another, very fast.
Whatβs actually going on
The CPU (Central Processing Unit) is a tiny silicon square β usually 1β4 cmΒ² β packed with billions of transistors arranged into circuits that do exactly four things:
- Fetch an instruction from memory.
- Decode what the instruction means.
- Execute it (add, compare, jump, read, writeβ¦).
- Store the result somewhere.
Thatβs it. Thatβs the whole job. The CPU does this loop billions of times per second.
A modern CPU has multiple cores β independent workers on the same chip β and each core can often run two threads at once (Intel calls this Hyper-Threading). A desktop CPU might be β8-core / 16-thread,β meaning sixteen instruction streams running in parallel.
The CPU also has caches built in (weβll cover those in 0.1.7) β tiny, fast scratchpads of memory right next to the cores so they donβt have to wait for slow RAM every time they need a value.
Why a hacker cares
The CPU is a target and a weapon:
- Spectre and Meltdown (2018) β vulnerabilities in how CPUs do speculative execution that let untrusted code read memory it shouldnβt. Affected basically every Intel chip from the previous 20 years. Patched in microcode + OS.
- Microcode β the CPUβs own internal firmware. Intel and AMD ship microcode updates inside Windows / Linux updates. Compromise the microcode and you have a backdoor below the OS.
- Side-channel attacks β measure how long an instruction takes, or how much power it draws, and you can sometimes recover encryption keys from a CPU performing the encryption. Smart-card attacks have been doing this for 25 years.
- Cryptojacking β malware that quietly uses your CPU to mine cryptocurrency. Slow computer, hot lap, weird power bill.
The CPU is also the enforcer of security. Privileged execution levels (Ring 0 = kernel, Ring 3 = userland) are a CPU feature. Virtualisation extensions that let one machine run many isolated VMs are CPU features. TPM and secure-enclave chips are tiny CPUs whose only job is to keep secrets the main CPU canβt see.
In one sketch
ββββββββββββββββ CPU chip βββββββββββββββββ
β β
β βββββββββ βββββββββ βββββββββ β
β β Core 1β β Core 2β β Core 3β ... β
β β + L1$ β β + L1$ β β + L1$ β β
β βββββββββ βββββββββ βββββββββ β
β β
β βββββββββββββββββββββββββββββββββββ β
β β Shared L2 / L3 cache β β
β βββββββββββββββββββββββββββββββββββ β
β β
β Memory controller βΈ to RAM β
βββββββββββββββββββββββββββββββββββββββββββ
Reference and image credit
- Intel_4004.jpg β LucaDetomi, GFDL / CC BY-SA 3.0.
Memory peg
Fetch, decode, execute, store. Repeat 4 billion times a second. Thatβs all a CPU does. Everything else is decoration.