Log in

View Full Version : Multithreading with C++


Sagekilla
24th April 2009, 15:06
Can anyone recommend some good resources to use for setting up some simple multithreading with C++? If possible, the more simple the tutorial and example thread the better. I'm doing some simulations, and I want to be able to run multiple simulations in parallel, so I don't need to worry about dependencies between simulation A and simulation B.

Any help is much appreciated!

dancho
24th April 2009, 15:43
Here :) :

Introduction To Basic Multithreaded Programming (http://www.flipcode.com/archives/Introduction_To_Basic_Multithreaded_Programming.shtml)

Multithreading - Part 1 (http://www.flipcode.com/archives/Multithreading-Part_1.shtml)

Multithreading - Part 2 (http://www.flipcode.com/archives/Multithreading-Part_2.shtml)

Simple Win32 Thread Class (http://www.flipcode.com/archives/Simple_Win32_Thread_Class.shtml)

Sagekilla
25th April 2009, 02:51
Thanks for the link dancho ;)

You happen to know any for platform independent threads? I'm probably going to be running this on some flavor of linux somewhere along the lines (Since just about every supercomputer I know uses it).

JohnnyMalaria
25th April 2009, 03:10
Look up OpenMP.

BTW, if you want to run parallel but independent simulations, you could just launch them as separate processes instead of trying to run them from within a single process. This would be a lot easier to implement and defers all the thread handling to the OS.

Dark Shikari
25th April 2009, 04:10
pthreads are your friend.

KenD00
25th April 2009, 19:15
For a portable solution, take a look at the thread library from boost (http://www.boost.org).

:rolleyes:

AndreyKarpov
4th May 2009, 09:02
Parallel Programming Links Collection (http://www.viva64.com/links/parallel-programming/)

krosswindz
20th May 2009, 23:14
+1 for pthreads.