Aaron Bannert wrote:

On Sun, Nov 16, 2003 at 03:13:21PM -0500, Jeff Trawick wrote:

+1 This is great, but will having to call a function negatively affect
performance?

Of course :) Pick your poison.


Hmm...maybe we should compare performance of a functionized version
of atomics vs. doing the same using pthread mutexes.

I started to say "depends on the app, depends on the contention rate" but note that pthread mutex is a function call too. Hard to get beyond that part of the comparison. And on many OSs this is not just a function call but a syscall, which is even more expensive.


Beyond that, real mutex means that when there is contention you lose the CPU and the OS has to redispatch. No comparison in expense of redispatch vs. entry/exit linkage. It can be thousands and thousands of instructions vs. relatively small number (<30?).






Reply via email to