When Two Cores See Different Realities: The Cache Coherence Problem MESI Was Built to Solve

In 1984, researchers at the University of Illinois published a paper that would quietly shape every multicore processor built since. Mark Papamarcos and Janak Patel proposed a solution to a problem that didn’t seem urgent at the time—how to keep data consistent when multiple processors each have their own cache. Today, with CPUs packing dozens of cores, their invention runs on billions of devices, silently orchestrating a dance of state transitions every time one core writes to memory and another needs to read it. ...

10 min · 1998 words

What Your CPU Does When It Doesn't Know What Comes Next: The Hidden Science of Branch Prediction

The most famous question on Stack Overflow isn’t about JavaScript frameworks or Git commands. It’s about why sorting an array makes code run faster. The answer—branch prediction—revealed something most programmers never consider: your CPU spends considerable effort guessing what your code will do next. In 2012, a user named GManNickG asked why processing a sorted array took 11.777 seconds while the same operation on unsorted data took only 2.352 seconds—a 5x difference for identical computation. The accepted answer, written by user Mysticial, became the highest-voted answer in Stack Overflow history. It wasn’t about algorithms. It was about how processors handle uncertainty. ...

15 min · 2987 words