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 01:43 pm Sean Kelly wrote: > Joe Seigh wrote: > >>Statically or dynamically linked code? The only case I >>think you can safely get away with making LOCK optional >>is in system dynamically linked libraries that are hardware >>configuration specific. I use LOCK in inlined code since it's >>in effect statically linked and you don't know where the code >>will eventually execute. > > > What about testing the hardware configuration on startup and setting a > global state flag? Would it be worthwhile to do this and deal with the > duplicated asm and branching it would require? > Depends on whether the global state flag is in cache when you test it and whether ia32-64 handles short conditional jumps effectively. The condition means the pipeline stalls until the flag can be tested. It should be easy to measure the overhead though. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .