⚙️
beginner·8 min read

What is a CPU?

The Central Processing Unit (CPU) is the primary processor in a computer — the component that executes program instructions. Everything you do on a computer, from opening a browser to running a game, ultimately comes down to the CPU fetching instructions from memory and executing them, billions of times per second.

Cores and Threads

Early CPUs had a single core — one execution unit. Modern CPUs have multiple cores, each of which can run instructions independently and in parallel. A quad-core CPU can genuinely run four programs simultaneously, one per core. Intel's Hyper-Threading (and AMD's SMT) adds a second hardware thread per core, letting the OS schedule two threads on the same core by sharing execution units. A 16-core CPU with SMT appears to the OS as 32 threads, though two threads on the same core share resources and are not as fast as two independent cores.

  • ▸P-cores (Performance) run demanding single-threaded tasks; E-cores (Efficiency) handle background work at lower power.
  • ▸Clock speed (GHz) measures how many cycles per second the CPU executes; more cycles = more work, all else equal.
  • ▸Modern CPUs boost clock speed dynamically based on thermal headroom — Intel Turbo Boost, AMD Precision Boost.

Cache Memory

Fetching data from main RAM takes hundreds of nanoseconds — far too slow for a CPU running at 5 GHz. Cache memory is high-speed SRAM embedded on the CPU die, acting as a staging area for frequently used data and instructions. The CPU checks L1 cache first (fastest, ~1–4 ns, 32–128 KB per core), then L2 (~4–12 ns, 0.5–4 MB per core), then the shared L3 (~10–40 ns, 8–192 MB). A "cache miss" at L3 forces a main memory access, potentially stalling execution for 60–100+ ns.

LevelLatencyTypical SizeShared?
L1~1–4 ns32–128 KB per coreNo
L2~4–12 ns0.5–4 MB per coreNo
L3~10–40 ns8–192 MB totalYes (all cores)
RAM~60–100 ns8–128 GB systemYes

The Instruction Pipeline

Modern CPUs don't execute instructions one at a time sequentially. They use a pipeline — breaking instruction execution into stages (Fetch → Decode → Execute → Write Back) and processing multiple instructions simultaneously at different stages, like an assembly line. A 20-stage pipeline can have 20 instructions in flight simultaneously. Superscalar CPUs have multiple execution units so they can retire more than one instruction per clock cycle, further boosting throughput. Out-of-order execution lets the CPU reorder instructions to avoid stalls.

  • ▸IPC (Instructions Per Clock) measures how many instructions a CPU completes each cycle. Modern CPUs target 4–6+ IPC.
  • ▸Branch prediction guesses which way an if/else branch will go so the pipeline can speculatively execute ahead.
  • ▸Pipeline flushes (mispredictions) waste cycles. Deeper pipelines are more efficient but costly to flush.

CPU Performance: What Actually Matters

Raw clock speed is not the whole story. A CPU running at 4.0 GHz with better IPC can outperform one at 5.0 GHz with worse IPC. Memory bandwidth and latency matter for data-intensive workloads. The manufacturing process node (Intel 7, TSMC N3B) affects power efficiency and how many transistors fit on the die. For gaming, single-core performance and cache size are most important; for rendering and video encoding, core count and memory bandwidth dominate.

Note: TDP (Thermal Design Power) specifies the maximum heat a cooler must handle under typical use. Desktop i9-14900K has a 253 W MTP — it needs a large heatsink or AIO liquid cooler.
CPUHardware basicsCoresCacheIPC