Subj : Re: What is the real costs of LOCK on x86 multiprocesor machine? To : comp.programming.threads From : Joe Seigh Date : Sat Jul 30 2005 08:52 am David Schwartz wrote: > "Joe Seigh" wrote in message > news:8vWdnYDkq-S__HbfRVn-gQ@comcast.com... > > >>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. > Making the memory accesses complete degrades much of the pipeline even if true serialization doesn't occur. Memory ordering would have been much better though it still would have been a full memory barrier. Serialization in my experience was used on mainframes to enforce hardware error boundaries on things like context switching. In theory you could use it for things like IPC without context switching (kernel calls) but I've not seen any actual implementations myself. You need instructions with cross address space support. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .