Cores & Threads
Multi-core processors and simultaneous task execution
Introduction
For decades, CPU performance improved primarily through higher clock speeds. But around 2005, chip manufacturers hit a wall — the "frequency wall" — where increasing clock speed produced too much heat and power consumption. The industry needed a new approach, and the answer was multi-core processors.
Instead of making one core faster, manufacturers began putting two, four, eight, or even more cores on a single chip. Each core is essentially a complete CPU — with its own ALU, control unit, and cache — capable of running its own program independently. This meant that a dual-core processor could theoretically do twice as much work as a single-core processor at the same clock speed, as long as the software was written to take advantage of multiple cores.
Alongside multiple cores came threading — the ability to split a program into multiple streams of execution that can run concurrently. Technologies like Intel's Hyper-Threading (and AMD's SMT) allow a single core to handle two threads simultaneously, further improving efficiency by keeping the core's execution units busy even when one thread stalls.
How It Works
A multi-core CPU is like having multiple chefs in a kitchen. One chef can only cook one dish at a time, but with two chefs, they can prepare two dishes simultaneously — chopping vegetables on one side while grilling steak on the other. The kitchen (the CPU package) has a single pantry (shared cache) and set of tools, but each chef works independently on their assigned recipe.
Household Object Analogy
Think of a delivery company. A single-core CPU is one delivery driver making one trip at a time. A multi-core CPU is a fleet of drivers, each with their own van (core). Threads within a core are like having two drivers share one van — when one is delivering a package, the other can plan the next route using the same vehicle resources. Hyper-Threading is that second driver sharing the van without needing a second vehicle.
Deeper Dive
A physical core is a complete, independent processing unit on the CPU die with its own dedicated execution resources. A logical core (or thread) represents a virtual processing unit created by technologies like Hyper-Threading or SMT. With Hyper-Threading, a single physical core can appear as two logical cores to the operating system, allowing it to run two threads simultaneously.
The operating system's scheduler assigns threads to logical cores. If a physical core supports two threads, and one thread stalls (waiting for memory, for example), the other thread can use the core's execution units that would otherwise be idle. This typically provides a 15-30% performance improvement over a single-threaded core, though the exact gain depends on the workload.
Multi-Core Architectures
Modern CPUs use different multi-core architectures depending on their target market. Desktop processors like the AMD Ryzen and Intel Core series typically feature 6 to 16 high-performance cores. Server processors like AMD EPYC or Intel Xeon can have 64 to 128 cores or more. Mobile processors like Apple's M-series use a hybrid architecture — a mix of high-performance cores (for demanding tasks) and high-efficiency cores (for background tasks), optimising battery life while maintaining responsiveness.
The cores on a multi-core CPU share certain resources, particularly the last-level cache (L3 cache) and the memory controller. This shared cache is beneficial because if one core accesses data from memory, it becomes available to all other cores at cache speed. However, sharing also creates challenges — if multiple cores try to write to the same memory address simultaneously, the cache coherence protocol must ensure all cores see a consistent view of memory.
Parallelism: Task vs. Data
Multi-core processors enable two main types of parallelism. Task parallelism divides a program into different tasks that can run concurrently — for example, a web browser might have one thread rendering a page, another downloading an image, and a third handling user input. Data parallelism splits a large dataset across multiple cores so that each core works on a subset — for example, processing 1000 images on 4 cores, each handling 250 images.
Not all programs benefit equally from multiple cores. Workloads that are embarrassingly parallel (like video rendering, scientific simulations, or machine learning training) can scale almost linearly with core count. Sequential workloads (like most legacy games or single-threaded applications) see little benefit beyond one or two cores. This is why single-core performance still matters, and why CPUs with fewer but faster cores can outperform chips with many slow cores on certain tasks.
Cache Coherency and Coherence Protocols
When multiple cores each have their own L1 and L2 caches, a problem arises: if core A modifies a value in its cache, core B might still have the old value in its cache. The cache coherence protocol (such as MESI or MOESI) ensures that all cores see a consistent view of memory. When a core writes to a cached address, it broadcasts a message to other cores, invalidating their cached copies so they must fetch the updated version.
This coherence traffic is a necessary overhead of multi-core systems. As core counts increase, the amount of coherence traffic grows, potentially becoming a bottleneck. This is known as the coherence wall, and it is one reason why scaling to hundreds of cores is significantly more challenging than just putting more cores on a die.
Key Insight
The move to multi-core processors was a fundamental shift in computing. Instead of relying on physics to make individual transistors faster, the industry embraced parallelism — doing more work simultaneously rather than doing individual work faster. This is why modern software is increasingly written with concurrency and parallelism in mind.
Advanced
At a deeper level, cores & threads involves rules and patterns that engineers use worldwide. Core follows standards so different brands and devices can still work together. That is why your phone, school laptop, and game console can all connect to the same network or use the same apps.
Thread does not happen in a straight line. Systems often use backup paths, error checking, and retries so information arrives correctly. When something fails, smart Hyper-Threading design helps the system recover instead of shutting down completely.
Scientists and engineers keep improving these systems every year — making them faster, safer, and more energy-efficient. The ideas you learn in this chapter are the same building blocks used in real data centers, robots, apps, and websites around the world.
Vocabulary Table
| Term | Definition |
|---|---|
| Core | An independent processing unit within a CPU that can execute its own instructions and run its own program |
| Thread | A single sequence of program instructions that can be scheduled and executed independently by the OS |
| Hyper-Threading | Intel's implementation of SMT, allowing one physical core to present as two logical cores to the OS |
| SMT | Simultaneous Multi-Threading — technology that lets a single core execute multiple threads concurrently |
| Multi-Core | A CPU design where multiple independent cores are integrated on a single chip |
| Parallelism | The ability to execute multiple tasks or data operations simultaneously across multiple cores |
| Scheduler | The OS component that decides which thread runs on which core at any given time |
| Process | A program in execution that contains one or more threads sharing the same memory space and resources |
| Cache Coherence | A protocol that ensures all cores see a consistent view of shared memory across their private caches |
| Hybrid Architecture | A CPU design mixing high-performance cores with high-efficiency cores (e.g., Apple M-series) |
Fun Facts
The first dual-core processor for consumer PCs was the Intel Pentium D (2005), but it was essentially two separate dies glued together. AMD's Athlon 64 X2 (also 2005) was the first true native dual-core CPU with both cores on a single die sharing a memory controller.
Intel's Hyper-Threading was introduced in 2002 on Xeon processors and later on Pentium 4. It was disabled on some lower-end Pentium 4 models via a fuse, making it one of the earliest examples of feature binning through fuse disabling.
The AMD EPYC 9654 "Bergamo" (2023) has 128 cores and 256 threads — making it one of the highest-core-count server CPUs. Each core has its own private L1 and L2 caches, plus 384 MB of shared L3 cache across all cores.
Apple's M1 Ultra (2022) uses UltraFusion to connect two M1 Max dies, creating a 20-core CPU (16 high-performance + 4 efficiency cores). The interconnection has 10,000+ signals delivering 2.5 TB/s of bandwidth between the dies.
Amdahl's Law predicts the maximum speedup from parallelisation. If 10% of a program is sequential, the maximum speedup is 10x — no matter how many cores you add. This is why optimising serial portions of code is so important.
Interactive Diagram
Launch the interactive diagram to see Cores & Threads in action.
Open Interactive DiagramThe interactive diagram for this chapter demonstrates Cores and Threads. It shows a multi-core CPU with threads being distributed across cores for parallel processing.
What to explore:
- add or remove tasks; watch the OS distribute them across cores; see how multi-threading improves efficiency
- multiple cores allow a CPU to process several tasks simultaneously, while threads enable each core to handle multiple instruction streams
Knowledge Check
1. What is the difference between a physical core and a logical core (thread)?
Answer: A physical core has dedicated execution resources; a logical core shares a physical core via SMT/Hyper-Threading
2. Why do some programs not benefit from having many CPU cores?
Answer: The program may have sequential parts that cannot be parallelised, limiting overall speedup
3. What problem does the cache coherence protocol solve in multi-core CPUs?
Answer: It ensures all cores have a consistent view of memory when data is modified in their private caches
