12 CPU and Performance Fundamentals
Adding cores to an R job often helps less than expected, and most of the reasons are in the hardware. A cache miss that goes to main memory costs hundreds of cycles. The memory bus has a fixed bandwidth that a few cores can use up. Two hardware threads on one core share its execution units. And R’s vectorized arithmetic, SIMD instructions and multithreading are different things that the word “vectorized” tends to blur. This section covers these limits as constraints a runtime has to work within, not as hardware design.
Work-stealing schedulers and garbage collectors are designed around the same limits, to keep contention and cache misses down.
After this section
You will understand why adding more cores does not always help. You will measure speedup honestly and explain its limits. You will distinguish between cache benefits, SIMD instruction throughput, and multicore parallelism. You will recognize bandwidth-bound and latency-bound tasks and know which to parallelize.
The pages
From Cores to Hardware Threads. Simultaneous multithreading, physical cores, logical processors, and why reported thread count misleads worker-count choices.
The Cache Hierarchy and Memory Bandwidth. L1, L2, L3 caches, cache lines, locality, cache misses, and why memory access patterns dominate arithmetic on modern CPUs.
Latency versus Throughput. The distinction between response time and work per unit time, and when optimizing one costs the other.
SIMD, R Vectorization, and Threads. Three different meanings of vectorization and why R’s vectorized syntax is not parallelism.
Amdahl’s Law and Scaling Limits. The mathematical model, the serial fraction as a ceiling, and the practical limits that bite before Amdahl does.
Before this section
You have read about concurrent threads and why parallelism helps. You know how to benchmark a piece of code.
Where this leads
This section feeds into work-stealing scheduling, which relies on understanding contention and cache effects. It informs decisions about thread pool sizing. It grounds the scaling measurements in speedup and scaling, which shows you how to measure honestly.
NUMA gets only a short treatment here. Branch prediction, instruction-level parallelism, and cost models for synchronization primitives are left out.