Subj : Re: STL Containers w/ Virtually Zero-Overhead Lock-Free Reads... To : (Usenet) From : Joe Seigh Date : Sun Sep 25 2005 11:15 am David Abrahams wrote: > "Chris Thomasson" <_no_spam_cristom@no_spam_comcast._net> writes: > >>Many existing application defined algorithms that decided to use STL >>containers in multithreaded environments use mutexs to protect everything >>anyway; therefore they are already compatible with the requirements of the >>highly flexible lock-free algorithm I am using. Application defined >>algorithm can literately pick and choose exactly which if their "read-only >>operations" can be executed without a lock. For instance, a thread that >>makes frequent read-only const_iteration's over a shared collection would be >>a great candidate to "lock-free-ize"... > > > I thought you were "lock-free-izing" the container. If so, you have > done nothing to protect the entire process of iterating over it from > being disturbed by writes. If not, maybe you should revise your > description of what you're proposing. He's proposing a readers/writers solution, i.e. write with concurrent reads. It's for scalability which is mostly subjective. If you don't think you have a scalability problem then you don't need lock-free. If you have a single threaded application then you won't expect better performance on a multiprocessor vs. a single processor system and you don't need lock-free. If you have a multi-threaded application and you don't expect better performance the more processors you have then you don't need lock-free. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] .