Subj : Re: What is the real costs of LOCK on x86 multiprocesor machine? To : comp.programming.threads From : David Schwartz Date : Sat Jul 30 2005 05:19 am "Joe Seigh" wrote in message news:8vWdnYDkq-S__HbfRVn-gQ@comcast.com... > David Schwartz wrote: >> Sadly, the penalty comes from the fact that the lock must take place >> during the execution of a single instruction. This means that no other >> operations can overlap that instruction, so the pipelines all empty, the >> instruction is processed, then the pipelines fill again. This has a huge >> cost on the p4. > It doesn't serialize the processor, there are instructions that do this. > It "serializes" the memory accesses, i.e. they complete rather than just > get ordered. Instruction prefetching can still occur so the pipeline > isn't completely flushed. Self modifying code needs to use additional > synchronization. It is not guaranteed to serialize the processor; however, my experience has been that it in fact does this. Locked operations could be a lot more optimized than they are, it just doesn't seem to have been a priority. DS .