from Hacker News

The Problem with Threads (2006) [pdf]

by DonbunEf7 on 5/4/18, 5:55 PM with 55 comments

  • by jgtrosh on 5/4/18, 10:25 PM

    This piece seems to have predicted a very active field in everyday software development since then.

    What are the alternative paradigms that have actually become common use? Coroutines, async/await, that's what I hear about online but what are others? I've seen people who touted zmq-communicating-processes with standard patterns as the solution to all problems, and I'm happy not to have to maintain the results.

    Have we effectively “solved” the concurrency problem, and if so what's left as an exercise for the future?

  • by rectang on 5/4/18, 10:03 PM

    I've always liked section 3 of this paper, specifically the concept that "infinite interleavings" make threads executing in parallel non-deterministic and difficult to reason about. That gets to the heart of why threaded programs are so prone to heisenbugs.

    "They make programs absurdly nondeterministic, and rely on programming style to constrain that nondeterminism to achieve deterministic aims."

    You can't write an infinite number of test cases for all those interleavings, and it requires hard thought to suss out where any problems might lie.