Worked examples — Instruction-level vs thread-level parallelism
This page is the "no scenario left behind" companion to the parent topic. Before we start, one promise: every symbol used here is defined the first time it appears. If you have not yet met Amdahls-Law, do not worry — we rebuild it below.
Look at the picture: the amber block is the serial part — it never shrinks. The cyan blocks are the parallel part — those we cut into pieces. The total time is amber + (one cyan slice). No matter how big grows, the amber block is a floor you can never dig below. That single idea drives every surprise on this page.
The scenario matrix
Every parallelism problem you will meet falls into one of these cells. The examples that follow are labelled with the cell(s) they cover, and together they hit all of them.
| Cell | What makes it special | Covered by |
|---|---|---|
| A. High-, high- | Almost everything parallel, many workers (best case) | Ex 1 |
| B. Low- (serial chain) | Dependencies dominate; parallelism fails | Ex 2 |
| C. (degenerate) | Purely serial — sanity floor | Ex 3 |
| D. (degenerate) | Perfectly parallel — sanity ceiling | Ex 3 |
| E. (limiting) | Infinite hardware — where's the ceiling? | Ex 4 |
| F. Combining ILP × TLP | Two speedups multiply | Ex 5 |
| G. Word problem | Real workload, must extract and yourself | Ex 6 |
| H. Exam twist | "Given the speedup, find " — solve backwards | Ex 7 |
| I. Wrong category | SIMD mislabelled as ILP/TLP (the classic trap) | Ex 8 |
Forecast (guess first): eight cores — do you expect exactly 8×? Write your guess down.
- Identify the pieces. Why this step? The master formula needs and ; name them so we don't mix ILP and TLP numbers. Here and .
- Serial part . Why? This is the amber floor — the 1% that runs no matter what.
- Parallel part shrunk . Why? The cyan block cut into 8 slices; we only wait for one slice.
- Add and invert. Why? Master equation. Total time = floor + one slice, and speedup is its reciprocal.
Verify: 7.48× is below 8× (the guess), which is correct — the 1% floor steals the rest. Sanity: if the floor were , we'd get exactly ? No — with floor and we get exactly 8. Good, our answer sits just under the perfect ceiling, as it must.
Forecast: 4-wide hardware — surely at least 2×? Guess.
- Name the pieces: , . Why? This is ILP now, so = instruction independence, = instructions/cycle. See Pipelining-Hazards for why the chain stalls: it's a load-to-use hazard.
- Serial part . Why? 90% of instructions must wait — a giant amber floor.
- Parallel part shrunk . Why? Only 10% overlaps, across 4 slots.
- Combine:
Verify: 1.08× ≈ almost nothing. The 4-wide machine is wasted because the dependency chain dominates — exactly the lesson: data structure, not hardware width, decides the ceiling. Units check: is a ratio, dimensionless. ✓
The figure contrasts an array (independent cyan arrows, all fire at once) with a linked list (amber chain, each arrow must wait for the one before). This is why arrays win at both ILP and TLP.
Forecast: what speedup do you expect at each extreme?
- Case . Why this step? This is the floor test — if the formula misbehaves here, it's wrong. Nothing parallel ⇒ no speedup. Correct.
- Case . Why? This is the ceiling test. Everything parallel ⇒ full × speedup. Correct.
Verify: gives 1 (no gain) and gives exactly (perfect scaling). These bracket every real answer: any real program lives strictly between them, which is why Ex 1 landed at 7.48 (near ceiling) and Ex 2 at 1.08 (near floor). ✓
Forecast: infinite cores — does the speedup blow up to infinity?
- Write the formula and push up. Why? We want the ceiling, so we take the limit as .
- Let the shrinking term vanish. Why? as — dividing a fixed number by an ever-bigger one goes to zero.
- Plug : .
Verify: even with infinite hardware, a 5% serial part caps you at 20×. This is the amber floor made numeric — it's exactly the "floor you can never dig below" from Figure 1. Related trap in Power-Performance-Tradeoffs: adding cores past this point burns power for zero gain.
The curve flattens toward the dashed amber line at . Notice how quickly it plateaus — most of the benefit is gone by 32 cores. That flattening is the whole reason scheduling and low serial overhead matter more than raw core count.
Forecast: do these add (2.11 + 7.46) or multiply?
- Recompute with , . Why? Confirm the input before combining.
- Recompute with , . Why? Same reason.
- Multiply, don't add. Why? ILP shrinks each core's time by 2.11×; TLP then shrinks the already-shrunk time by 7.46× more. Sequential shrinks compound.
Verify: if we had added we'd get 9.57×, which is wrong — the shrinks are independent multipliers, like two discounts stacked. SMT and superscalar live at the ILP layer; cache coherence governs the TLP layer — different layers, so they multiply. ✓
Forecast: with 6 cores, guess the final time.
- Total serial baseline s. Why? is a fraction of the original single-thread time, so we need that total.
- Compute = parallel seconds ÷ total = . Why? By definition is the fraction of the original time that overlaps.
- Apply master formula, , .
- Convert back to time: new time s. Why? Speedup = old/new, so new = old/.
Verify (units!): new time should equal serial part + parallel part on 6 cores s. ✓ Matches exactly, and the units are seconds throughout.
Forecast: high or low ? Guess before solving.
- Start from the master formula and treat as the unknown. Why? We know and ; algebra recovers .
- Invert both sides. Why? Get rid of the fraction by taking reciprocals.
- Expand the right side. Why? Collect the terms.
- Solve for .
Verify: plug , back in: , , sum , reciprocal . ✓ So only 76% was parallel — the other 24% serial capped the gain at 3×.
Forecast: is the student right?
- Recall the categories. Why? The whole page rests on keeping ILP, TLP, and DLP separate. See SIMD-Vector-Processing.
- ILP = many independent instructions overlapping.
- TLP = many independent threads.
- DLP (data-level) = one instruction over many data elements (SIMD).
- Classify the SIMD add. Why? One
vaddpsis a single instruction in the pipeline, however many floats it touches. - Count it correctly. A lone SIMD add contributes to ILP, not 8. The "8" is the SIMD width (DLP), a different axis entirely — see Memory-Level-Parallelism for yet another orthogonal axis.
Verify (numeric): if that SIMD add is the only instruction per cycle, the ILP factor is , giving from ILP alone — the speedup came from DLP, not ILP. The student mislabelled the axis. ✓
Recall Self-test — cover the answers
Which cell has a speedup you can never exceed no matter the hardware? ::: Cell E — the limit is , the serial floor. If ILP gives 2× and TLP gives 5×, combined speedup is? ::: — they multiply, not add (Cell F). A pure SIMD add contributes what to your ILP count ? ::: Just — it's data-level parallelism, not ILP (Cell I). Measured 3× on 8 cores means roughly what parallel fraction? ::: About (Cell H).