Subj : Re: Lock Free -- where to start To : comp.programming.threads From : Joe Seigh Date : Thu Sep 29 2005 02:28 pm Oliver S. wrote: >>This would be true for the Michael-and-Scott queue algorithm; >>its loaded with cache thrashing CAS-loops. > > > You misunderstand me; I talked about the producer/consumer-pattern > with the usual mutex-locks (which cause a kernel-intervention only on > collisions). In this case, the lock is held an extremely short inter- > val and the processing of the data taken from the queue lasts at least > some thousand times longer than the dequeue-process. So the likehood > of a collision is that short, that there's no need for lock-free pro- > cessing? > That would be for a small number of threads. If probability of lock contention for a single thread is .001 in your example, then for 100 threads it's about ..100, 200 threads about .199, 1000 threads about .630, etc... Lock-free is about scalability, not the actual overhead. If you know your application will never experience high contention or you don't care about scalability then you should stick with conventional lock based solutions. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .