On August 18, 2016 5:51:31 PM GMT+02:00, Andi Kleen <a...@firstfloor.org> wrote:
>> I'd prefer to make updates atomic in multi-threaded applications.
>> The best proxy we have for that is -pthread.
>> 
>> Is it slower, most definitely, but odds are we're giving folks
>> garbage data otherwise, which in many ways is even worse.
>
>It will likely be catastrophically slower in some cases. 
>
>Catastrophically as in too slow to be usable.
>
>An atomic instruction is a lot more expensive than a single increment.
>Also
>they sometimes are really slow depending on the state of the machine.

The important part is to optimize increments in loops - sth we have special 
ways to do for the regular counters.  OTOH if we can delay instrumenting to 
late enough we can instrument loops optimized in the first place.

Richard.

>-Andi


Reply via email to