For my project, I need to learn multithreading in C++. I have read 4-5 articles on Google, and have searched for more but they all are more or less similar. I want to learn it in depth. Can you provide me some links/source/anything for learning mutilthreading in C++? I am clear with the basics and want to explore more.

All links have how to create thread, how to wait for threads to complete, how to syncronize but they just have the overview. I want some explanations with examples and in detail.

Any help would be appreciated. Thanks.

Recommended Answers

All 5 Replies

Nitin,

The only way to learn threads is to start implementing it.
You will rarely find articles that would cover threads in-depth.
Even if it covers it would only talk about how to create/destroy/sleep threads and other mechanisms like thread synchronization.

Try to create some utility applications and use threads heavily. That is the way you will learn more about threads.

What OS are you working with?

For Windows you could do worse than the book "Win32 Multithreaded Programming" by Cohen & Woodring.
https://www.powells.com/biblio/9781565922969
OK, it is ancient now, but it is what I used years ago and I still think it is a useful resource. It is available for cheap now and well worth a read.

I am using LINUX system 64 bit OS for this purpose.

That book is not for you then, but I don't know what to suggest as an alternative for Linux. Threading typically involves OS calls (or a framework providing a wrapper around the OS calls) and you need something OS-specific to get you started. I don't know Linux but I am sure someone else will be able to help.

Now that we have C++11, which comes with threads, we no longer need anything platform specific.

The best book on threading with C++11 I've found is the Anthony Williams book "C++11 Concurrency in Action". Williams' company has been selling a threading library for years and he really knows his stuff, and on StackOverfow he wears a funny hat: http://stackoverflow.com/users/5597/anthony-williams

It's not a cheap book, sadly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.