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 03:52 pm Mirek Fidler wrote: > Joe Seigh wrote: > >> Sean Kelly wrote: >>> 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. > > > AFAIK not true. That is what branch prediction is for, is not it? > > I believe that in case of testing single flag that never changes, > actuall amortized branch costs will be lower than one cycle. > That's for prefetching the instructions. The actual instruction can't be executed until the actual flag value is known. If the flag test can be moved forward of the branch you can get some benefit that way. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .