Description

Parallelism means doing multiple operations at once to raise throughput and cut run time. Architects exploit it at different levels:

LevelFull nameWhat runs in parallelTypical hardware
DLPData-Level ParallelismSame operation on many data itemsSIMD units, vector processors, GPUs
ILPInstruction-Level ParallelismIndependent instructions from one threadPipelines, superscalar, out-of-order cores
TLPThread-Level ParallelismMultiple threads/processesMulticore CPUs, SMT (hyper-threading)
RLPRequest-Level ParallelismIndependent user requestsWarehouse-scale computers

Strengths and drawbacks:

  • DLP: high throughput, energy efficient for regular numeric work; suffers from irregular data and control divergence (branches in GPU threads).
  • ILP: speeds up single-thread code with no programmer effort; diminishing returns from dependences and mispredicted branches, and complex hardware.
  • TLP: scales with cores; costs synchronization, shared-resource contention (caches, memory bandwidth) and harder software.

Flynn's Taxonomy (Michael Flynn, 1966) classifies machines by the number of instruction streams and data streams:

ModelInstruction streamsData streamsExample
SISD11Simple sequential CPU, early PCs
SIMD1ManyVector units, AVX/SSE/NEON, GPUs
MISDMany1Rare; redundant fault-tolerant systems
MIMDManyManyMulticore CPUs, clusters, cloud servers

Modern multicore CPUs are MIMD, and each core may also contain SIMD units and ILP hardware, so one chip uses all levels at once.

Key Formulas

Parallel speedup (Amdahl):      S(n) = 1 / [ (1 − f) + f / n ]
Parallel efficiency:            E(n) = S(n) / n
Ideal pipeline speedup:         ≈ number of pipeline stages
Vector/SIMD speedup (ideal):    ≈ number of lanes

Steps

To classify a machine with Flynn: (1) count independent instruction streams, (2) count independent data streams, (3) pick the cell: 1/1 SISD, 1/many SIMD, many/1 MISD, many/many MIMD.

To pick the right parallelism for a workload: (1) same op on big arrays → DLP; (2) independent instructions in a loop body → ILP; (3) independent tasks/requests → TLP/RLP.

Worked Example

  1. Adding two 1,000,000-element arrays element by element → DLP (SIMD). With 8 lanes the ideal speedup is ~8×.
  2. a = b + c; d = e * f; have no dependence, so a superscalar core issues both in one cycle → ILP.
  3. A web server serving 32 clients on 16 cores → TLP (MIMD).
  4. Efficiency: 8 cores give speedup 5.93 (95% parallel) → E = 5.93/8 ≈ 74%; 64 cores give 15.4/64 ≈ 24%. More cores, diminishing returns.
  5. Classify: GPU shader running one program on many pixels → SIMD (more precisely SIMT); lock-step triple-redundant flight computer comparing results → MISD in concept.

Python / Assembly

import numpy as np
from concurrent.futures import ProcessPoolExecutor

# DLP: one vectorized operation over all elements (NumPy uses SIMD underneath)
a = np.arange(1_000_000, dtype=np.float64)
b = np.arange(1_000_000, dtype=np.float64)
c = a + b                          # replaces a Python loop

# TLP: CPU-bound work needs processes (Python threads share the GIL)
def work(n):
    return sum(i * i for i in range(n))

if __name__ == "__main__":
    with ProcessPoolExecutor() as pool:
        print(list(pool.map(work, [10**6] * 4)))

ILP in assembly: independent instructions can issue together; dependent ones cannot.

add  x5, x1, x2     # independent of the next line
mul  x6, x3, x4     # can execute in the same cycle on a superscalar core
add  x7, x5, x6     # depends on both, must wait (RAW)

Notes

  • SIMD vs SIMT: GPUs run thousands of threads in groups (warps) that execute one instruction together; programmers write per-thread code, hardware does the SIMD grouping.
  • Python threads do not speed up CPU-bound code because of the Global Interpreter Lock; use processes or native code.
  • Quick facts: multicore processors are MIMD; DLP uses one instruction on many data, ILP runs many instructions in parallel.

References: [HP6] Ch. 1 (1.2, 1.4), Ch. 3-5 intros; Flynn, "Very High-Speed Computing Systems," Proc. IEEE, 1966; [PH-RV] Ch. 6;