Overview

Multi-threading allows a processor to switch between different tasks (threads) to keep its execution units busy. This can be done at the software level (OS context switching) or supported directly by the hardware.

Hardware Support

Hardware multi-threading allows the CPU to hold the state of multiple threads simultaneously, reducing the overhead of switching between them.

Types

  • Fine-grained: Switches threads every cycle.
  • Coarse-grained: Switches threads only on long-latency events (like a cache miss).
  • Simultaneous Multi-threading (SMT): Executes instructions from multiple threads in the same cycle.