Subj : Re: lockless models and memory coherency To : comp.programming.threads From : Joe Seigh Date : Thu May 19 2005 07:49 pm On Thu, 19 May 2005 14:11:42 -0600, Chris Friesen wrote: > I've been trying to reconcile two different ideas. > > On the one hand, POSIX threading guarantees memory coherency only by > using locking mechanisms. (This ties back into the whole "is volatile > needed" issue that has been hashed over many times in this list.) > > On the other hand, there are all these lockless data structures that > people are using. > > How do you guarantee memory coherency across CPUs with a lockless data > structure in a portable way? Do lockless implementations necessarily > require hardware-specific implementation to ensure coherency across cpus? > Yes, but so do lock implementations. You define the api such that all the platform dependent stuff is addressed in the implementation of the api. That's what Posix does and that's what the lock-free api's do or should be doing. The people doing this stuff have a pretty good idea what can and cannot be ported. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .