Sorry, I have to amend my statement.  I just ran an experiment which launched 10000 threads vs launching 4 threads and doing the same amount of work.  Results seem to indicate that the former is quite expensive on Linux too -- about 2 orders of magnitude different in my test.

Note that some of this effect could also be from side effects from time slicing, etc... in the kernel scheduler.

  Brian

On Jan 29, 2008 11:25 AM, Brian Budge <brian.budge@gmail.com> wrote:
Hi James -

My impression was that creating new threads on Windows can be quite expensive, but I don't have a lot of experience there.  Creating threads in Linux using posix_threads (also via boost) seems to be quite fast.

However, I have noticed that thread_groups are much slower (factor of 4) than using my own vector<boost::thread*> and joining each individually.  This is probably because I have only one controlling thread for my vector, so I don't need mutex.

  Brian


On Jan 29, 2008 10:28 AM, James Sutherland <James.Sutherland@utah.edu> wrote:
On 1/29/08 9:54 AM, "Sebastian Gesemann" <s.gesemann@gmail.com> wrote:

> You may want to try
http://threadpool.sourceforge.net/

I was looking into that, but was wondering if anyone had experience to
suggest that creation/destruction of threads was a significant overhead
before I implement pools.

James
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users