views:

385

answers:

6

I'm looking for a good guide/tutorial on multithreading in C++ (and ideally in general). Can anyone point me to a good online resource?

EDIT: I intend to familiarize myself with either the boost threading library or the one from Poco.

+1  A: 

If you mean to parallelize computation for multi-core, check out OpenMP. It has gcc and intel (I'm not sure about Visual C++) support, and is a lot easier than using primitives.

wrang-wrang
Thanks for the link, I did not know about OpenMP before. I find this very interesting, however, my main goal is to find a good guide about multithreading like how to use locks, how to avoid deadlocks, etc...
StackedCrooked
I'd be interested in an answer to that, too. It's tricky, so higher level constructs should be favored.
wrang-wrang
+4  A: 

The Dr. Dobbs article "The Boost.Threads Library" is a short introduction to the subject, using one of the Boost C++ Libraries.

Peter Mortensen
Yep, that's a good start
Maciek
+1  A: 

Check out this useful video-lectures from Intel: http://software.intel.com/en-us/videos/three-things-you-must-teach-module-1-recognizing-potential-parallelism/

This tutorial covers:

  • Importance of parallelism
  • Shared memory model and threads
  • OpenMP basics

The video tutorial is very short: about 60 minutes, so I hope you will find it useful.

Vova
+4  A: 

That's not a tutorial, but a good set of articles Effective Concurrency by Herb Sutter.

Kirill V. Lyadvinsky
+3  A: 
Michael Damatov
A: 

If you're going to use boost::thread, I'd make sure to check out Anthony Williams' website, blogs and articles he maintains boost::thread contributed to the C++0x library particularly the threading components and the information he provides is accurate, relevant and concise.

He also has a book coming out this fall on modern C++ threading called Concurrency in Action.

Joe Duffy's book and blog is also a good resource.

Rick