Re: multithreading.
On Mar 27, 11:55 pm, Alexander Dong Back Kim <alexdb...@gmail.com>
wrote:
On Mar 28, 7:38 am, Juha Nieminen <nos...@thanks.invalid> wrote:
mohi wrote:
the only one of those many reply had boost library mentioned which i=
have heard about before
You won't even consider OpenMP? It's a much simpler way to
use multithreading in your C++ program. (Of course it
requires compiler support.)
Could you please give me some hints about benefits and
drawbacks of OpenMP and Boost?
They are designed to do completely different things. OpenMP, if
I understand it correctly, is designed largely to parallelize
operations on large arrays, in the presense of multiple cores.
Boost is designed for the classical "threading" applications,
where different threads are used to react to different events,
i.e. one thread can go off and perhaps execute some blocking
requests in response to one event, and the other threads will
continue handling other events.
Boost threads is a very low level wrapper around the system
threads, based more or less on the Posix model (mutexes and
conditions). AS such, I'd strongly recommend it, in
collaboration with the Butenhof (got it right this time, I
hope), for learning the low level basics. In any real
application, of course, you'll probably want to wrap it in
something a bit higher level. (Generally speaking, you'll want
a function to start detached threads, and a thread object with
more or less entity semantics for joinable threads. You can
also consider something like futures.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34