Subj : Re: STL Containers w/ Virtually Zero-Overhead Lock-Free Reads... To : (Usenet) From : Chris Thomasson Date : Thu Sep 22 2005 06:16 am > I could be missing something important, but it seems to me that if you > want to "actually apply some algorithms to it" then a lock-free > container is of little use, since you get synchronization at the wrong > level of granularity. You'd need algorithm-level synchronization, > rather than container-level synchronization, in that case. In other > words, the SGI argument against putting mutexes in the containers > applies just as well to the question of whether lock-free container > operations are a good idea. Per-container mutexs? That would be a nightmare! Think of an applications that happens to create extremely high numbers of collection objects... ;) You could use groups of global "static" arrays of mutexs. Hash the this pointer of a collection into an index and do your business. There is a catch, you can deadlock real fast, like this: http://groups.google.com/group/comp.programming.threads/msg/56406d367ac85dcb?hl=en A scaleable solution involves keeping order/track of the array of mutexs an application thread has locked on a per-thread basis... [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] .