On Sat, Dec 18, 2010 at 01:53:36PM +0100, Tim Moore wrote: > On Sat, Dec 18, 2010 at 2:27 AM, David Fries <[email protected]> wrote: > > > Computers are coming out with more and more cores which will only > > increase the number of threads in use. Currently OpenSceneGraph has a > > bottleneck in scene graph operations limiting the performance of > > multithreaded programs, even when they are operating on completely > > separate nodes as the Drawable, Node, and StateAttribute addParent and > > removeParent all contend on one global mutex. > > > > OpenThreads::Mutex* getRefMutex() const { return > > getGlobalReferencedMutex(); } > > > Thanks for looking into this. Some of us have recently been looking hard at > thread safety and performance issues in OSG. > > The global referenced mutex is unfortunate, not least because its use is > buggy. I would facetiously call it a "Writer lock;" writers of the _parents > list lock it, but none of the readers do! So obviously this should be some > kind of ReaderWriter lock, but that has its own issues, not least of which > is that the OpenThreads ReaderWriterMutex implementation is suspected of > being buggy, if I recall correctly. > > So, I don't know what to say about your Atomic Global Mutex work. My own > feeling is that something like Linux' RCU list > (http://en.wikipedia.org/wiki/Read-copy-update), which would eliminate most > of not all of the synchronization on the parent list, is a better approach. > This is even more true if the global mutex were being used correctly :)
The kernel is in a unique position when it comes to RCU, in that it does the scheduling and it can know that all users of the previous structure are finished with it. There's also the question of does it cause problems to be looking at the old set of parents when another thread made and change. -- David Fries <[email protected]> http://fries.net/~david/ (PGP encryption key available) _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

