Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well, based on the original videos Rich did to promote Clojure, I think I remember him claiming that STM was never meant for cases where you wanted parallelism for performance reasons.

STM was intended to make it less error prone to use threads in places where concurrency was the right fit for the problem.



When is parallelism ever needed but for performance reasons? (Honest question, I'm quite a novice when it comes to concurrency)


I 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.


Yeah I remember the benchmarks, didn't look too good. People claimed that with hardware support for transactional memory things could be different. We have that now in the latest Intel CPUs (Skylake for sure), anyone got further information?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: