The Problem with Threads (2006) [pdf]
www2.eecs.berkeley.edu
The Problem with Threads (2006) [pdf]
1–10 of 56 posts
Re: The Problem with Threads (2006) [pdf]
#2"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.
Re: The Problem with Threads (2006) [pdf]
#3I'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 i…
My favorite one is where adding debug traces causes the heisenbug to disappear because the printf() inserted a memory fence somewhere deep in the logging library.
Nothing like debugging via atomics.
Re: The Problem with Threads (2006) [pdf]
#4What 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?
Re: The Problem with Threads (2006) [pdf]
#5I'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 i…
Sometimes it's hard to tell when a resource is shared, but that has more to do with not knowing how the code works than it does with multi-threading.
Re: The Problem with Threads (2006) [pdf]
#6This 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 w…
Coroutines don't solve the parallelism part, because they're concurrent but exclusive.
Async/await as implemented in JavaScript doesn't solve the parallelism part either for the same reason, and async/await as implemented in C# has exactly the same problem as threads.
There are many ideas for how to solve the problem - but I think anyone who is honest will tell you none are a perfect solution to all situations where you want parallelism or concurrency.
For example to use zmq-communicating-processes effectively you need a problem where you can divide the data or tasks cleanly a-priori. We simply don't have the mathematical understanding of how to do that to some important algorithms that people really need to run in parallel today, such as triangulation or mesh refinement.
We probably need some radical new idea, or maybe it's looking increasingly like only a mix of ideas will work.
Re: The Problem with Threads (2006) [pdf]
#7I'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 i…
This is just my opinion, but I've never found that part of multi-threading difficult. Interleaving doesn't matter except where resources are shared between multiple threads, and the solution is to protect the resource with a mutex. Sometimes it's hard to tell when a resource is shared, but that has more to do with not knowing how the code works than it does with multi-threading.
With respect, this sort of thing works a lot better for small codebases where you're the only one working on it. Multithreading when you can't contain the entire relevant codebase in your brain is where the real challenge is.
Re: The Problem with Threads (2006) [pdf]
#8This 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 w…
Re: The Problem with Threads (2006) [pdf]
#9This 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 w…
Re: The Problem with Threads (2006) [pdf]
#10This 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 w…
What do you mean by "the concurrency problem"?