Computer Architecture Cheatsheet

I/O and Buses

Use this Computer Architecture reference while you build software engineering projects, review code for technical interview prep, or polish examples for a software engineer resume.

I/O Fundamentals

I/O devices connect to the CPU and memory through buses — shared communication channels. The CPU communicates with devices via:

MethodDescriptionAddress space
Memory-mapped I/O (MMIO)Device registers appear as memory addressesUnified with RAM
Port-mapped I/O (PMIO)Separate I/O address space; in/out instructionsx86-only, 64 K ports

MMIO is universal; port I/O is an x86 legacy used mainly for ISA-compatible devices.

Bus Characteristics

PropertyDescription
WidthNumber of data lines (bits transferred in parallel)
Clock speedTransfers per second (synchronous) or handshake-based (async)
Bandwidthwidth × clock (peak)
LatencyTime from request to first byte
Shared vs point-to-pointShared buses arbitrate; point-to-point are always dedicated

Polling vs Interrupts vs DMA

Polling (Programmed I/O, PIO)

CPU repeatedly reads a device status register until ready, then reads/writes data.

while (!(device->status & READY))  // spin
    ;
data = device->data_register;
  • Pro: simple, predictable latency for fast devices
  • Con: wastes CPU cycles (busy-wait)

Interrupts

Device signals CPU when ready. CPU saves state, runs Interrupt Service Routine (ISR), resumes.

StepAction
1CPU issues I/O command to device
2CPU continues executing other work
3Device raises interrupt line (IRQ)
4CPU acknowledges, saves PC + flags, masks IRQ
5CPU jumps to ISR via interrupt vector table
6ISR reads/writes data, clears interrupt
7CPU restores state, resumes interrupted task

Interrupt priority: hardware has priority levels; higher-priority IRQs preempt lower. x86 has 256 interrupt vectors (0–255); vectors 0–31 are CPU exceptions, 32–255 are maskable hardware interrupts.

DMA (Direct Memory Access)

DMA controller moves data between device and memory without CPU per-byte involvement.

CPU                   DMA Controller          Device
  │                         │                   │
  │──start transfer──►│     │                   │
  │  (src, dst, count)│     │                   │
  │                   │──request data──────────►│
  │   (CPU free)      │◄─── data ──────────────│
  │                   │──write to memory        │
  │                   │   (repeats count times) │
  │                   │──interrupt CPU──────────►│
  │◄──done interrupt──│                          │
  • CPU overhead: just setup + completion interrupt (not per-byte)
  • Required for fast devices (NICs, NVMe, GPUs)
  • Modern: IOMMU (Input-Output MMU) virtualizes DMA addresses for safety

Bus Standards and Interconnects

Historical Internal Buses

BusWidthSpeedEra
ISA16-bit8 MHz1984–1990s
PCI32/64-bit33/66 MHz1992–2004
AGP32-bit66 MHz × 1/2/4/81997–2004
PCI-X64-bit133 MHzServers

PCIe (PCI Express) — Current Standard

Point-to-point serial lanes; each lane = 1 differential pair each way.

VersionPer-lane bandwidthx16 bandwidthYear
PCIe 3.01 GB/s each direction16 GB/s2010
PCIe 4.02 GB/s32 GB/s2017
PCIe 5.04 GB/s64 GB/s2019
PCIe 6.08 GB/s128 GB/s2022

Common configurations: x1, x4, x8, x16. GPU slots: x16. NVMe SSD: x4.

Storage Interfaces

InterfaceMax bandwidthProtocolNotes
SATA III600 MB/sAHCILegacy HDDs/SSDs; shared bus
M.2 NVMe (PCIe 3.0 x4)3.5 GB/sNVMeModern SSD
M.2 NVMe (PCIe 4.0 x4)7 GB/sNVMeFast consumer SSD
M.2 NVMe (PCIe 5.0 x4)14 GB/sNVMeCutting-edge
U.2 / U.3PCIe x4NVMeEnterprise SSD

External / Peripheral

InterfaceMax speedNotes
USB 2.0480 Mb/sKeyboard, mouse
USB 3.2 Gen 15 Gb/sFlash drives
USB 3.2 Gen 210 Gb/sExternal SSDs
USB 3.2 Gen 2×220 Gb/sDual lane
USB4 Gen 3×2 / Thunderbolt 440 Gb/sUSB-C; tunnels PCIe + DP
Thunderbolt 5120 Gb/sBidirectional burst
Ethernet1–400 Gb/sLAN/WAN
DisplayPort 2.180 Gb/sVideo
HDMI 2.148 Gb/sVideo + audio

CPU Interconnects (Multi-Socket)

TechnologyVendorBandwidthNotes
UPI (Ultra Path Interconnect)Intel10.4–20 GT/s2-socket Xeon
Infinity FabricAMDVariableEPYC CCD-to-CCD + I/O die
NVLink 4NVIDIA900 GB/s totalGPU-to-GPU
CXL (Compute Express Link)IndustryPCIe-basedMemory/device coherency

Interrupt Controllers

ComponentDescription
PIC (8259A)Legacy; 8 IRQ lines, cascade for 16; x86 original
APIC (Advanced PIC)Per-core Local APIC + I/O APIC; up to 255 IRQs; modern x86
MSI / MSI-XMessage Signaled Interrupts — device writes to memory-mapped register; no IRQ wire; PCIe default
GIC (ARM)Generic Interrupt Controller; Cortex-A systems

MSI-X supports up to 2048 interrupt vectors per device, enabling per-queue interrupts in NICs and NVMe controllers (no lock contention).

Bus Arbitration

For shared buses, the bus master must be decided:

MethodDescription
Daisy chainPriority by position on chain; fast but unfair
CentralizedBus arbiter decides; fair (round-robin)
DistributedEach device signals on dedicated lines; priority encoded
Token passingOnly device holding token can use bus

Modern systems use point-to-point links (PCIe, Infinity Fabric) that eliminate arbitration — each link is dedicated.

I/O Performance Metrics

MetricDefinition
ThroughputMB/s or GB/s sustained
IOPSI/O operations per second (random small I/O)
LatencyTime from command issue to data received
Queue depthNumber of in-flight I/O requests

IOPS vs throughput trade-off: small random reads maximize IOPS; large sequential reads maximize throughput.

Example: NVMe SSD — 1 M IOPS @ 4 KB random; 7 GB/s sequential throughput.