Appearance
CPU, FDE Cycle & Execution Time
Core Component
In Plain English (30-Second Refresher)
The CPU (Central Processing Unit) executes every program by repeating one tiny loop billions of times per second: Fetch the next instruction, Decode what it means, Execute it in the math engine, and Store the answer (the FDE, Fetch–Decode–Execute, Cycle). How fast your program actually finishes depends on three numbers, not just GHz (gigahertz, billions of clock ticks per second): how many instructions you run, how many clock ticks each instruction takes (CPI), and how fast the clock ticks.
▶ The 60-Second Story (Scroll or Press Play)
Follow one tiny job: your game score going from 42 to 52. Scroll down and the kitchen comes to life chapter by chapter, or hit ▶ Play and just watch. The four-step loop along the bottom always shows where you are. (In X-ray view, ns = nanoseconds, billionths of a second; ms = milliseconds, thousandths of a second.)
Chapter 1 / 11
The mission: one coin = +10 points
You're playing a game. Your score is 42. You grab a coin worth +10. For the screen to show 52, the game sends one tiny job to your computer's brain, the CPU: "add 10 to the score." This whole story follows that one job.
💡 Why Every app, from games to WhatsApp, is millions of tiny jobs just like this. Understand one and you understand them all.
↓ Keep scrolling to continue the note
Core Principles (Remember Just These 3)
- Every app boils down to the FDE Cycle:
Fetch → Decode → Execute → Store— repeated ~4 billion times a second per core. - The Iron Law of CPU Execution Time:
CPU Time = (Instruction Count × CPI) ÷ Clock RateCutting instructions (better algorithm/compiler) or lowering CPI (better CPU design + cache hits) often beats cranking up GHz! - Never judge a CPU by GHz or core count alone: Real speed =
Clock × IPC (work per tick) × Active Cores.
Pictionary Mental Model
Picture Inside a CPU Core in 5 Seconds
Six visual anchors covering the FDE Cycle, Clock, and Pipelining
🔖
Recipe Bookmark
⇢PC (Program Counter)
Points to the exact memory address of the next instruction to fetch.
🎛️
Chef Reading Step
⇢Control Unit (Decode)
Translates raw 1s & 0s into electrical signals telling the ALU (Arithmetic Logic Unit) what to do.
🧮
Chopping Board
⇢ALU (Execute)
Performs the actual math (+, -, ×) and logic comparisons (>, ==, AND).
🥣
Bowl in the Chef’s Hand
⇢Registers (~0.3 ns)
Holds the exact numbers currently being worked on — zero reach time (0.3 ns = 0.3 billionths of a second).
🎼
Kitchen Metronome
⇢Clock (GHz)
Sets the heartbeat: 4 GHz = 4 billion ticks per second.
🏭
Car Wash Line
⇢Pipelining
Overlaps Fetch, Decode & Execute for multiple instructions at once.
Visual Mental Model
🔤 Terms in this picture: SRAM (static RAM, the super-fast memory used for caches) · RAM (Random-Access Memory, the main working memory) · L1 / L2 / L3 (cache levels: smallest and fastest first).
Caption: Every CPU core loops endlessly through Fetch → Decode → Execute → Store, relying on on-chip SRAM caches to avoid slow trips to RAM.
Hands-On Lab: Step Through the FDE Cycle & Test CPU Execution Time
Use Tab 1 to step through live CPU registers (PC Program Counter, MAR Memory Address Register, MDR Memory Data Register, IR Instruction Register, R1 a working register), or switch to Tab 2 to play with the Iron Law sliders and watch a modern 3.6 GHz CPU crush an old 5.0 GHz CPU:
⚙️ CPU Hands-On Lab: FDE Cycle & Execution Time
Step through live CPU registers, or test the Iron Law of CPU Performance
PC (Program Counter)
0x100 → 0x104
Bookmark of next instruction
MAR (Memory Address)
0x100
Address sent to cache/RAM
MDR (Memory Data)
ADD R1, #10
Raw data fetched back
IR (Instruction Reg)
ADD R1, #10
Current decoded command
Register R1 (Data)
42
Working value in CPU's hands
1. FETCH (Grab Instruction): Program Counter (PC) sends address 0x100 to MAR → memory returns "ADD R1, #10" into MDR → copied to IR, and PC advances to 0x104.
How It Works (Interactive Animated Flow)
Compare a blazing-fast L1 Cache Hit against a Cache Miss stall below:
The CPU Instruction Cycle (Fetch → Decode → Execute → Store)
Watch how one instruction moves inside a CPU core
Inside the 4-Step FDE Cycle (With the 5 Key Registers)
- Fetch: The PC (Program Counter) copies the next instruction's address into the MAR (Memory Address Register) → memory returns the binary instruction into the MDR (Memory Data Register) → copied to the IR (Instruction Register) → PC increments to the next address.
- Decode: The Control Unit cracks the opcode inside IR into electrical control signals.
- Execute: The ALU (Arithmetic Logic Unit) runs arithmetic (
+,-,*) or logic (>,==,AND,OR). - Store (Write-Back): The output saves into a general-purpose register (or ACC — Accumulator) and eventually syncs back to Cache/RAM.
4 Secret Speed Boosters Inside Modern CPUs
- Pipelining (Assembly Line): While Instruction #1 is Executing, Instruction #2 is Decoding, and Instruction #3 is Fetching — finishing ~1+ instruction every clock tick!
- Superscalar & Out-of-Order Execution: Modern cores execute 4–8 independent instructions per single clock cycle (
CPI < 1.0, meaningIPC > 1.0!) by reordering instructions that don't depend on each other. - Branch Prediction: At an
if (x > 0)check, the CPU guesses the outcome and computes ahead. Right guess = free speed; wrong guess = pipeline flush (~15–20 wasted cycles). - Multi-Core, SMT & Hybrid (P+E) Cores: Multiple physical cores run parallel tasks; SMT / Hyper-Threading runs 2 threads per core; P-Cores sprint on heavy tasks while E-Cores sip battery on background work.
Reading a CPU Spec Line in 30 Seconds
A CPU's spec line is basically a job ad for the kitchen staff. Here's a real one, decoded (GHz = gigahertz, MB = megabytes, W = watts):
Intel Core i7-14700K · 20 cores (8P + 12E) · 28 threads · up to 5.6 GHz · 33 MB cache · 125 W
| Spec | What it actually means | Kitchen picture |
|---|---|---|
| 20 cores (8P + 12E) | 20 independent workers: 8 big Performance cores for heavy work, 12 small Efficiency cores for background jobs | 8 head chefs + 12 junior cooks |
| 28 threads | Each P-core can juggle 2 threads (SMT / Hyper-Threading); E-cores juggle 1. So 8 × 2 + 12 = 28 | A head chef keeping two orders going, switching whenever one is waiting |
| up to 5.6 GHz | The boost clock: top speed for short bursts while the chip is cool. The base clock is lower, the speed it can hold all day | Sprinting vs. a pace you can keep all shift |
| 33 MB cache | 33 megabytes of L3 cache shared by all cores | The shelf all the chefs share |
| 125 W | Power (and so heat) it's designed to draw at base speed; your cooler must remove it | How hard the extractor fan has to work |
Two things people get wrong
- A thread is not a second core. Both threads share one core's calculators (ALUs), so SMT usually adds roughly 15–30%, not 2×.
- Apple M-series and most ARM chips don't use SMT, so for them threads = cores. Compare core counts, not thread counts.
One Chef, Many Orders: Multitasking vs. Multithreading
Your laptop is running hundreds of threads right now on maybe 8–20 cores. There aren't enough chefs for every order, so the kitchen fakes it:
| Term | What's really happening | Kitchen picture |
|---|---|---|
| Multitasking | The OS (operating system) gives each program a time slice of a few milliseconds, then swaps to the next one (a context switch). Swapping fast feels like "all at once" | One chef cooking several orders by switching between them every few seconds, noting the bookmark each time |
| Multithreading | One app splits its own work into several threads, so several cores can work on it at the same time (e.g. a video export) | One big order split so several chefs cook parts of it in parallel |
| SMT / Hyper-Threading | One core runs 2 threads, filling the idle gaps of one (e.g. a cache miss) with work from the other | While waiting for an ingredient from the countertop, the chef works on the second order |
Why it matters: a single-threaded app only ever uses one chef, however many you own. If Task Manager / Activity Monitor shows one core at 100% and the rest idle, more cores won't help that app. A faster core will.
More Cores ≠ Proportionally Faster (Amdahl's Law, Worked Out)
Think of a banquet: chopping can be split among many cooks, but the head chef must plate and taste every dish alone. That solo part sets a hard limit.
Example: a 100-second job where 20 s must run on one core (serial) and 80 s can be split across cores:
| Cores | Serial part | Split part | Total time | Speed-up |
|---|---|---|---|---|
| 1 | 20 s | 80 s | 100 s | 1× |
| 2 | 20 s | 40 s | 60 s | 1.7× |
| 4 | 20 s | 20 s | 40 s | 2.5× |
| 8 | 20 s | 10 s | 30 s | 3.3× |
| 16 | 20 s | 5 s | 25 s | 4× |
| ∞ | 20 s | ~0 s | 20 s | 5× max |
text
Speed-up = 1 ÷ (serial + parallel ÷ cores)
8 cores: 1 ÷ (0.2 + 0.8 ÷ 8) = 3.3×Real life is even less generous: all the cores share the L3 cache and the memory bandwidth (every chef shares one countertop), and coordinating them takes time too. For work that is almost entirely splittable (pixels or artificial intelligence (AI) maths), the answer is thousands of simple cores: a GPU (Graphics Processing Unit). See GPU & AI Accelerators →.
Minimal Example / Cheat Sheet (FDE + Iron Law)
text
FDE Trace for: score = score + 10
1. LOAD R1, [score] → Fetch from RAM/L1 into Register R1
2. ADD R1, R1, #10 → Decode + ALU adds 10 in 1 clock cycle (~0.25 ns)
3. STORE [score], R1 → Write updated R1 back to Cache
CPU Execution Time (The Iron Law):
CPU Time = Instruction Count (IC) × CPI × Clock Cycle Time
= (Instruction Count × CPI) ÷ Clock Rate
Example: 1 Billion instructions × 1.0 CPI ÷ 4 GHz (4 Billion cycles/sec)
= 0.25 seconds (250 ms)!Trade-offs: Single-Core Speed vs. High Core Count
| Prioritize High Single-Core Speed When | Prioritize High Core Count (16–128 Cores) When |
|---|---|
| Gaming, snappy desktop UI (user interface), single-threaded Python/JS scripts, low-latency trading | Compiling huge repos, video rendering, running Docker/VMs (virtual machines) & multi-user backend servers |
(Want to know how Intel vs. AMD (x86-64) compare against Apple Silicon (ARM64) and RISC-V (an open Reduced Instruction Set Computer design)? Read the next note: CPU Architectures →)
Common Gotchas
Watch Out For
- The Gigahertz Myth: A 5.0 GHz CPU with
CPI = 3.2is nearly 3× slower than a 3.6 GHz CPU withCPI = 0.8! Test it in the Iron Law lab above. - Cache Misses Explode Your CPI: One L1 hit takes
~3–4 cycles, while one RAM cache miss stalls the core for~200–300 cycles— which is why data locality in code matters so much! - Amdahl's Law (More Cores ≠ Linear Speedup): If 20% of your program is strictly sequential, even 1,000 CPU cores can never make it more than 5× faster (see the worked table above).
- Overclocking = more speed, more heat: Running a CPU past its rated clock needs more voltage, which means more power and heat. Gains are often only single-digit percent, while the risks are crashes, louder cooling, and possibly a voided warranty. Modern CPUs already auto-boost close to their safe limit.
Quick Self-Check (Restore Your Memory)
Try answering in your head before expanding each answer:
1. What roles do PC, MAR, MDR, and IR play in the FDE Cycle?
PC (Program Counter) bookmarks the next instruction address; MAR sends that address to memory; MDR catches the fetched bytes returning from memory; IR (Instruction Register) holds the current instruction while the Control Unit decodes it.
2. What are the three levers in the Iron Law of CPU Execution Time?
(1) Instruction Count (improved by better algorithms/compilers), (2) CPI — Cycles Per Instruction (improved by pipelining, caches, and CPU architecture), and (3) Clock Rate (GHz).
3. How can a CPU have a CPI less than 1.0 (e.g., CPI = 0.5)?
Through Pipelining and Superscalar execution — a modern CPU core decodes and executes multiple independent instructions in parallel during the exact same clock tick (IPC = 2.0 → CPI = 0.5).
🎬 Now Watch It Happen
2-minute episode
Zoom into a real CPU core and watch the moment Coin Dash adds 10 points: fetch → decode → execute → store: S1 · E3 — 4 Billion Steps a Second →