by devxpy · 8y ago · 0 comments
The problem is that its _hard_ to get right.
For example - It's not trivial to use locks when you're working at an abstraction level higher than operating systems. Most people don't even realise there is a race in their application, because locks are inherently non-enforcing. Code written in locks is also really hard to read and reason by.
Message passing just makes it a little more trivial to avoid the pitfalls associated with parallel programming.
I also found that it lets you avoid busy waiting in certain places, which is always a performance advantage :)
Can you shed some light on those "idiot-proof thread-safe datastructures"?
Futures in particular make it easy to write concurrent code close to the way you would write single-threaded code, because all of the threading is handled behind the scenes.
Please research your topic.
(Speaking purely from experience. Don't have a fancy CS degree)
Given those restrictions and use cases you get a very efficient low latency locking mechanism.