Skip to content
Chethan Yadav_
Computer Architecture

COA/Lesson 6 of 6/7 min read

I/O and Parallelism

I/O techniques, buses, Flynn's taxonomy, multicore and SIMD, GPUs, Amdahl's and Gustafson's laws, and shared vs distributed memory.


On this page

I/O techniques

The CPU talks to devices (disks, NICs, keyboards) through device controllers, each with status, control and data registers. There are three ways to move data.

TechniqueCPU involvementBest for
Programmed I/O (polling)CPU loops checking statusVery fast devices or tiny transfers
Interrupt-driven I/ODevice signals when readyKeyboards, low-rate devices
Direct memory accessController copies blocks itselfDisks, network, large transfers

Programmed I/O

The CPU repeatedly reads the device's status register (busy waiting or polling) until it is ready, then moves each word itself.

while (device.status != READY) { }   // wastes CPU cycles
device.data = word;

Simple, but wastes CPU time on slow devices. High-performance network stacks (DPDK, NVMe polling) use polling deliberately because at very high rates it beats the overhead of interrupts.

Interrupt-driven I/O lets the CPU do other work until the device signals completion, and block transfers can be offloaded entirely to a DMA controller. Both are covered from the OS side in the OS introduction and file systems and I/O.

Memory-Mapped I/O

How does the CPU address device registers?

  • Memory-mapped I/O: device registers occupy part of the physical address space; ordinary LOAD and STORE instructions access them. Used by ARM, RISC-V and most modern systems.
  • Port-mapped (isolated) I/O: a separate address space accessed with special instructions like x86 IN and OUT.
Memory-mappedPort-mapped
InstructionsRegular load and storeSpecial I/O instructions
Address spaceShared with memorySeparate
CachingMust be marked uncacheableNot an issue

Buses

A bus is a shared communication path with three groups of lines:

  • Address bus: which location; width sets the addressable space (32 bits = 4 GB).
  • Data bus: the data; width sets how much moves per transfer.
  • Control bus: read/write, clock, interrupt request, bus grant.

Modern systems replace shared parallel buses with point-to-point serial links: PCIe lanes, NVMe over PCIe, DDR memory channels, and on-chip interconnects.

Bus Arbitration

When several masters (CPU, DMA controller) want the bus, an arbiter decides:

  • Daisy chaining: grant passes along a chain; simple but position fixes priority.
  • Centralized parallel arbitration: each device has its own request and grant lines to a central arbiter.
  • Distributed arbitration: devices resolve priority among themselves (used in CAN bus).

Flynn's Taxonomy

Classifies architectures by instruction and data streams.

ClassInstruction streamsData streamsExample
SISDSingleSingleClassic uniprocessor
SIMDSingleMultipleVector units, GPUs
MISDMultipleSingleRare; fault-tolerant flight systems
MIMDMultipleMultipleMulticore CPUs, clusters

SIMD

One instruction operates on many data elements at once. x86 SSE and AVX (128, 256, 512-bit registers) and ARM NEON add 4, 8 or 16 floats in a single instruction. Compilers auto-vectorize simple loops; it shines in image processing, ML and audio.

MIMD

Independent processors run independent instruction streams on independent data. Covers multicore chips (shared memory) and clusters (distributed memory).

Instruction-Level Parallelism

ILP runs independent instructions from a single thread at the same time, invisibly to the programmer: pipelining, superscalar issue, out-of-order execution and speculation (pipelining). ILP hit diminishing returns in the mid-2000s, which pushed the industry toward multicore.

Why multicore happened

The power wall: dynamic power is about C * V^2 * f. Raising frequency also needs higher voltage, so power and heat grew too fast. Instead of one faster core, chips added more cores at moderate clock speeds.

Multicore Processor

Several independent cores on one chip, each with private L1 and usually L2 caches, sharing L3 and the memory controller. Software must be written with multiple threads or processes to benefit.

LevelParallel unitManaged by
Bit-levelWider wordsHardware
Instruction-levelInstructionsHardware and compiler
Data-levelVector elementsSIMD, GPUs
Thread-levelThreadsOS and programmer
Request-levelIndependent requestsServers, clusters

Hyper-Threading

Intel's name for simultaneous multithreading (SMT): one physical core keeps two hardware thread contexts (registers, PC) and interleaves their instructions to fill idle execution units, for example while one thread waits on a cache miss. Typically 15 to 30% more throughput, not 2x. The OS sees two logical CPUs per core.

GPU

A GPU has thousands of simple cores organized into streaming multiprocessors that execute groups of threads (warps of 32 in NVIDIA) in lockstep, a model called SIMT.

CPUGPU
CoresFew, complexThousands, simple
Optimized forLatency of one threadThroughput of many
Cache and controlLargeSmall
Good atBranchy, serial logicData-parallel math (graphics, ML)

Branch divergence within a warp serializes the paths and hurts performance.

Amdahl's Law

The speedup from parallelizing is limited by the part that stays serial.

Speedup(N) = 1 / ((1 - P) + P / N)

where P is the parallel fraction and N the number of processors.

Example: 90% parallel code on 10 cores: 1 / (0.1 + 0.9 / 10) = 1 / 0.19 = 5.3x. On infinite cores: 1 / 0.1 = 10x maximum. The 10% serial part caps everything.

Parallel fraction4 cores16 coresInfinite cores
50%1.6x1.9x2x
90%3.1x6.4x10x
99%3.9x13.9x100x

Amdahl's Law also applies to any optimization: speeding up a part that takes 20% of the runtime can never give more than 1.25x overall.

Gustafson's Law

Amdahl assumes a fixed problem size. In practice, more processors are used to solve bigger problems in the same time.

Scaled speedup = N - (1 - P) * (N - 1)

With 90% parallel work on 10 cores: 10 - 0.1 * 9 = 9.1x. This is the more optimistic view behind weather simulation and ML training at scale.

Shared vs distributed memory

Shared memoryDistributed memory
CommunicationRead and write shared variablesExplicit messages over a network
ProgrammingThreads, OpenMP, locksMPI, RPC
ScalingLimited by coherence and bandwidthScales to thousands of nodes
Hard partSynchronization, racesLatency, partial failure

NUMA

Non-Uniform Memory Access: in multi-socket servers, each CPU socket has its own local memory. Accessing local memory is fast; accessing another socket's memory crosses an interconnect and is slower. The OS and databases try to keep threads near their memory (NUMA-aware allocation). UMA (uniform) systems have equal access time from every core.

Quick revision

  • I/O: programmed (polling) wastes CPU; interrupt-driven waits for the device; DMA moves blocks without the CPU.
  • Memory-mapped I/O uses normal loads and stores; port-mapped uses special instructions.
  • Flynn: SISD, SIMD, MISD, MIMD; GPUs and vector units are SIMD, multicore is MIMD.
  • The power wall ended clock scaling and started the multicore era.
  • SMT (Hyper-Threading) shares one core between two hardware threads for modest gains.
  • Amdahl: 1 / ((1 - P) + P / N); the serial fraction caps speedup.
  • Gustafson: scale the problem with the processors for near-linear speedup.
  • NUMA: local memory is faster than remote; keep threads near their data.