Subj : Re: CMPXCHG timing To : comp.programming.threads From : David Schwartz Date : Fri Apr 01 2005 09:16 pm "Michael Pryhodko" wrote in message news:1112409790.005060.46950@g14g2000cwa.googlegroups.com... >> > For me it is quite logical that they should spend the same amount >> > of >> > clocks for this operation (suppose that flushing store buffer >> > takes >> > the same time regardless of mem_addr). I understand that this is >> > only >> > my assumptions. >> There are so many reasons why this won't be true in the real >> world and >> new ones are appearing all the time. What about interrupts? > if interrupt happens before mov -- everything is ok > if interrupt happens between mov and sfence -- it will flush store > buffer (see IA Manual) -- i.e. will do the same thing as sfence > so interrupt is ok here -- either store operation never begun, or it > begun and finished in the finite time So now it sounds like you don't care whether the operations take the same amount of time or not. Could you try stating what you're trying to do in simple terms? For example, each each thread trying to exchange the same value or does each thread have a unique ID that it's trying to write? If each thread is writing a unique ID (unique to that thread), how does the extra write hurt you? Just have the thread go back and read the value and compare it a second time. It sounds, though, that all of this is more effort than just using the LOCK prefix. DS .