Subj : Re: lock on IA-32 To : comp.programming.threads From : Joe Seigh Date : Wed Mar 09 2005 08:07 pm On 9 Mar 2005 16:56:52 -0800, Michael Pryhodko wrote: > Is it possible to implement lock on IA-32 without using LOCK prefix > using following considerations: > > a) there could be arbitrary number of threads trying to grab the lock > b) every thread has **unique** number P != 0 (this is main thing behind > this whole idea) > > I was trying to build something like: (snip) > > Could anyone give me an insight? > > Also (since I do not now much about AMD architecture): is it possible > on AMD architecture? > There are distributed algorithms for mutual exclusion. Google for Dekker's algorithm or Peterson's algorithm. The algorithms assume a total order memory model so you need memory barriers to make it right in other memory models. -- Joe Seigh .