4 ms·
When is parallelism ever needed but for performance reasons? (Honest question, I'm quite a novice when it comes to concurrency)
by anamexis 10y ago
When is parallelism ever needed but for performance reasons? (Honest question, I'm quite a novice when it comes to concurrency)
- wtetzner 10y agoI maybe didn't word my comment very well. What I meant is that STM is meant to be used in cases where the problem you're solving is most easily expressed in a concurrent way. It's main use case is concurrency, as opposed to parallelism. For example, a web server is naturally concurrent. You definitely can implement a web server in a single-threaded manner, but you'll end up just faking concurrency anyway. So there are times where you'll want to use concurrency because the problem you're solving is naturally concurrent. In these cases, having an STM is valuable, because it makes it hard to get state changes wrong in a concurrent environment. It is not necessarily a way to make your program faster.