Boost logo

Boost Users :

From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2004-10-07 12:39:59


On Thu, 07 Oct 2004 18:14:53 +0100, Andrew Chapman > The thread
functor objects are being passed a lot of references (about

> 20) to some very large std::vectors. One thread always reads/writes from
> the start of the vectors to their midpoint, and the second thread from
> (midpoint+1) to the end of the vectors.

Perhaps you could provide some code? Are the threads using any sort
of synchronization between themselves? Perhaps you're spending a lot
of time contending on a mutex if so. If they're just operating on
some shared resources (the vectors) with no locking, they should
certainly run faster than the single-threaded case on a dual CPU
machine.

> The only thing I can think of is that the threads are taking a long time
> to fork and get running, perhaps moving a lot of stack data around or
> something?

I'd be suprised if the thread creation took any significant part of
your 45-second runtime.

-- 
Caleb Epstein
caleb.epstein_at_[hidden]

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net