What are the tradeoffs b/w boost::thread, std::thread (C++11), and pthread for high CPU throughput (read: lots of floating point operations) Linux based applications? When should one implementation be used over the others?
The use case here is to call a routine on a buffer (or pointer to a buffer) of contiguous memory, do some work, and return -- in a multithreaded implementation.
std::threadstd::thread::native_handle.boost::threadpthread:std::threadis often a good default. If you need features ofpthreadthat are not in the standard, you can use them with the help ofstd::thread::native_handle(with the implications on the portability that come with it). There's no reason to usepthreaddirectly otherwise (that I know of) in C++.boost::threadcan be used if you need ancient pre-C++11 support, to remain portable to other systems.Note that
std::threaditself doesn't need to be used directly. The standard has useful abstractions such asstd::reduce,std::packaged_task,std::async, parallel execution policies for algorithms etc.