Subj : Re: What is the real costs of LOCK on x86 multiprocesor machine? To : comp.programming.threads From : Mirek Fidler Date : Fri Jul 29 2005 07:36 pm >>Measuring the same on my uniprocesor AMD64 machine, LOCKed instructin >>seem to be 3 times slower than regular one, but I guess that has only a >>little relevance on real MP machine. > > > Surprisingly, on Intel Pentium processors the overhead of > a locked instruction is about the same for a single processor > as for one in a multiple processor configuration. Hm, can you give me some numbers? Is it closer to my measurement (3 times slower than non-atomic) or to 100 cycles I have seen somewhere? > > The way Microsoft (for example) avoid the performance hit is > to replace the LOCK prefixes in uniprocessor builds of their > operating system binaries with NOP instructions. I stepped through InterlockedIncrement and there definitely IS lock. Mirek .