5.3.14 · D1Advanced Microarchitecture

Foundations — Simultaneous multithreading (SMT - hyperthreading)

1,957 words9 min readBack to topic

This page builds — from absolute zero — every word and symbol the Simultaneous multithreading (SMT - hyperthreading) parent note leans on. Read it top to bottom: each idea is the floor the next one stands on. Nothing is used before it is drawn.


1. What is a "clock cycle"?

Everything a processor does is chopped into equal ticks of a metronome. One tick = one clock cycle. Inside one tick the chip can start (and often finish) a small amount of work.

Look at the figure: time runs left to right, split into equal boxes. Every box is one cycle. When we later say "IPC" or "500 cycles", we are simply counting boxes. That is the only clock we will ever mean.

Why the topic needs it
Every SMT claim ("both threads finish in 833 cycles") is a statement about how many boxes the work fills. Without a fixed tick, "throughput" would have no unit.

2. What is an "instruction" and an "execution unit"?

An instruction is one tiny order to the CPU: add these two numbers, load this value from memory, jump here if zero.

An execution unit is the physical circuit that carries out one kind of order. Real cores have several:

  • ALU (Arithmetic Logic Unit) — does integer add / subtract / compare.
  • FPU (Floating-Point Unit) — does decimal-number maths.
  • Load/Store unit — moves data between the core and memory.

The figure shows 4 tools (boxes) over several cycles. A green box = a tool doing real work this cycle. A grey box = a tool sitting idle. The whole point of SMT is: stop making grey boxes.


3. The symbol — how many execution units

We write for the number of execution units (tools) on the bench. The parent note uses .

Why it matters
is the ceiling on work-per-cycle. You physically cannot do more than instructions in one tick, no matter how many threads you run.

4. The symbol IPC — Instructions Per Cycle

Now the single most important symbol on the whole topic.

If a program runs 1000 instructions in 500 cycles:

Why IPC and not "speed in GHz"? Clock speed (GHz) tells you how fast the metronome ticks. IPC tells you how much you get done per tick. SMT does not speed up the metronome — it raises IPC by filling grey boxes. So IPC is exactly the right lens for this topic.


5. Utilization — the fraction of tools kept busy

With IPC and :

Why the topic needs it
Low utilization = many grey boxes = the empty seats SMT exists to fill. The whole motivation ("20–40% utilization") is this one fraction being small.

6. Why boxes go grey: stalls, dependencies, misses

Three reasons a tool sits idle. Each is a prerequisite topic in its own right.

(a) Data dependency. Instruction needs the answer of . Until finishes, cannot start — the tool waits. (Formally studied in Pipeline Hazards.)

(b) Cache miss. The data a load needs is not in the fast on-chip memory, so the core must fetch it from far-away DRAM — 50 to 200 cycles of waiting. Understanding where data lives is the Memory Hierarchy; keeping shared copies consistent is Cache Coherence. A stall is any such forced wait.

(c) Branch misprediction. The core guesses which way an if will go to keep working (Branch Prediction). A wrong guess throws away the work started down the wrong path — more grey boxes.

The figure shows one thread's timeline: a burst of green, then a long grey stall (cache miss), then green again. That grey gap is pure wasted hardware — and it is exactly where a second thread's instructions could go.


7. Thread, thread context, and "replicated vs shared"

A thread is one independent stream of instructions — one program's worth of orders in order.

To run two threads on one core, the core must remember two of certain small things:

These are cheap to duplicate (~5% extra silicon). Everything expensive — the execution units ( tools), caches, branch predictor — stays shared. That asymmetry (duplicate the tiny bookkeeping, share the big machinery) is the whole trick that makes SMT affordable.

Running multiple independent threads to get more work done is called Thread-Level Parallelism (TLP); SMT is simply TLP implemented inside one core, per cycle.


8. Throughput vs latency — the two clocks you must not confuse

Why the topic needs it
Every SMT number is a throughput win, often with a latency loss. Mixing these up causes Mistake 1 ("hyperthreading doubles performance"). It raises throughput ~1.2–1.4×; single-task latency can get worse.

9. The symbol and the speedup model

The parent's performance formula uses one final symbol:

Reading it in plain words: during the busy fraction the tools are already full, so a second thread adds nothing — that term stays as-is. During the stalled fraction , the second thread fills those gaps, halving the wasted time — hence . The denominator is "how much time the work now really takes"; one over it is the speedup.

With :

Notice the two extremes: (never stalls) gives speedup (no gain), and (always stalls) gives (the theoretical max). Every real workload sits between.


Prerequisite map

Clock cycle - the time tick

Instruction and execution unit

N - number of execution units

IPC - instructions per cycle

Utilization - fraction of tools busy

Stalls - dependency, cache miss, branch

Thread and thread context

Throughput vs latency

f and the SMT speedup model

Simultaneous Multithreading


Equipment checklist

Test yourself — you are ready for the parent note when you can answer each without peeking.

What one clock cycle counts as
The smallest fixed time tick of the processor; all events line up to its edges, and we measure work by counting these ticks.
What an execution unit is
A physical circuit (ALU, FPU, load/store) that carries out one kind of instruction; a core has several, one per "tool" slot.
What stands for
The number of execution units / dispatch width — the maximum instructions startable in one cycle, the ceiling on work-per-cycle.
The definition of IPC
Instructions completed divided by cycles taken; the average number of tool-slots actually filled per cycle.
How to get time from IPC
cycles — the IPC definition rearranged.
What utilization measures
, the fraction of execution units kept busy; low utilization (grey boxes) is the waste SMT targets.
Three reasons a tool goes idle
Data dependency (waiting on a prior result), cache miss (waiting on DRAM), branch misprediction (discarded wrong-path work).
Which state is duplicated per thread vs shared
Duplicated (cheap): PC, register file, thread state. Shared (expensive): execution units, caches, branch predictor, TLB.
Throughput vs latency
Latency = time for one task; throughput = total work per time across all threads. SMT raises throughput, may worsen latency.
What is and what speedup it gives at extremes
= fraction of stalled cycles; speedup , which is when and when .