apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: apr_atomic stuff... planning to move all implementation out of the header file
Date Sun, 16 Nov 2003 22:16:49 GMT
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?).





Mime
View raw message