Thursday, January 10, 2013
Concurrency in C++11
Here is a link to a nice presentation that a friend sent me (thanks Atila):
What I don't like in C++11: The Future pattern is going to be a can of worms when people start to chain .get()s.
It's going to be a pain to debug to the logic and it looks like you can get bitten badly by deadlock.
I like the monitor<T> template because it reminds me of STM and makes it very easy to make transactions.
The bad things is it is still vulnerable to deadlocks, and the that it uses mutexes, which means we can't expect high performance.
The concurrent<T> and the ideas behind it are amazing! It looks like it's going to be quite useful to implement fast asynchronous arbitrary pieces of code.
It is important to keep in mind that the tasks will still be "sequential" because they are all put in a worker thread, but they will be asynchronous from the calling thread's point of view which can be a great pattern to use in real-time systems and others where a particular thread should be responsive, like for example a GUI.