Boost logo

Boost :

From: Or Peles (or_at_[hidden])
Date: 2003-11-17 05:29:09


Hi people,

I'm using boost::shared_ptr extensively in my project. I've recently
encountered a disturbing ocurance:

While running a process on a 2 CPU intel machine with hyperthreading, I
noticed that the cpu isn't being used despite multiple threads that are
running in the program. Needless to say, the performance was not good.

I ran a profiler, and traced the problem to calls to Sleep made by the
boost::shared_ptr::shared_count class.

Moving the shared_ptr assignment out of the concurrent part (e.g. instead of
two assignments from concurrent threads a single assignment before the
multithreaded part) gave me a tenfold increase in performance.

Is this reasonable?

Or Peles,
Actimize Ltd.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk