C++ Multithreading on Unix

boostcmultithreading

I have two related questions:

  1. Are there any good books for multithreading in C++, especially now that C++11 contains multithreading in the standard library?

  2. I have the Wrox Programming on Unix book (1000 pages fat red one) and within it, it uses the Unix Thread class.

    • How does this code relate to boost and the C++11 multithreading libraries?
    • Is it better/worse/just specific to Unix etc?
    • Is the performance the same?

Best Answer

That's quite a question!

Threading is an OS task and traditionally people used pthreads on Unix and Windows Gui threads on Windows.
Boost::threads basically wraps these operating system services. How the compiler and OS maker implement c++11 threads is upto them, but generally you would not expect a huge performance difference between any of them.

If performance really matters then you probably need to get much finer grained than any of the general thread libraries and look at openMP, Intel TBB or OpenCL.