Subj : Re: full-blown experiential smr-based reference counted pointer impl... To : comp.programming.threads From : Joe Seigh Date : Fri Apr 01 2005 07:35 am On Fri, 1 Apr 2005 02:19:17 -0800, Chris Thomasson <_no_damn_spam_cristom@_no_damn_comcast.net_spam> wrote: >> You also need a release ( load/store, store/store) barrier before dropping >> the hazard pointer reference (setting it to zero). > > > Humm... > > If you wanted to implement this on sparc I guess you would need to do > something like this: > > > > > // Acquire Hazard > load target > loop: > store target into hazard ( store/load + store/store) > load target > compare target with hazard, goto loop if non-equal > > > > > // inside gc region wrt target > > > > > // Release Hazard > ( load/store + store/store ) > store null into hazard > > > > Is that about it? > You didn't need that 2nd membar since the reload and compare are local only. > > > >> >> Yes, you wouldn't use SMR for everything but there are definitely niche >> uses for it so it doesn't hurt to have it around. > > True... > In the sense that atomic_ptr and RCU have niche uses. They have different strengths. SMR has better granularity than a proxy GC like RCU. So for situations like where a thread holds a reference for a relatively long time, SMR is better than RCU since it won't tie up a lot of resources waiting to be released. But it probably doesn't scale as well under certain conditions. Even mutexes have niche uses. There are situations where they'll work better than lock-free solutions. -- Joe Seigh .