Hacker News new | ask | show | jobs
by stefan_ 1031 days ago
It's a very interesting phenomenon. There are lots of claims along the lines of "a single CPU is so fast it will exercise all kinds of multi-threading patterns very quickly" but in my experience it indeed takes multiple processors to reliably show up various races and faulty implicit orderings.
1 comments

Single processors interleave threads using very coarse "quantums" of execution, where each thread runs for many milliseconds at a time. Dual processors will run the instruction streams truly in parallel.

From a correctness perspective, they're "identical", because even on a single core a context switch can occur anywhere. In theory, even one core can interleave individual instructions, it's just not done for performance reasons.

So if multiple cores causes a crash, then that crash bug was always there, and could have occurred even on a single core. It's just much less likely to be triggered.

Thankfully now every mainstream computer and practically all phones are multi-core, so software has to be written properly. The early 2000s were a mess though, with a lot of heisenbugs that were maddening to track down.