I would like to learn how to build a multi-threaded application, but I don't even really know where to start.
How do most people implement multi-threading? Do they use the boost library? Is there some other way to do it? (using standard C / C++)
I understand the concept, but totally have no idea where to even start to actually learn how to do it. Can anyone recommend anything?
http://msdn.microsoft.com/en-us/library/7t9ha0zh%28v=VS.80%29.aspx <--- Are these standard C++, or some Microsoft-only implementation?
Am I correct that the multithreading libraries are contained in the Windows API? I found an example on MSDN ( http://msdn.microsoft.com/en-us/library/esszf9hw%28v=VS.80%29.aspx) and the functions it uses (ReleaseMutex, etc) seem to be in windows.h. Is this what most people are using when they do Windows programming?
Boost library is a cross-platform way of using threads.
Most people use winapi or pthreads. pthreads was originally used on POSIX systems but there is a port of it for mingw allowing its use on windows too.
I'd recommend using boost if you absolutely need cross-platform solution, or already have boost libraries linked. If you are developing for windows or POSIX, use winapi or pthreads correspondingly.
If you are looking for a simple performance boost for in your application through multi-threading OpenMP is a simple library that will allow your program to scale across multiple cores, requiring only #pragma placement in your code to parallelize blocks of code or loops, with additional options to weak specific performance.
This doesn't easily allow for coarse parallelism like a GUI/processing/IO division in the application, but does allow for easily visible multi-threading performance boosts on multi-core machines in heavy number-crunching.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With