On Thursday, December 12, 2002, at 12:34 PM, Greg Ames wrote:
I dug into APR locks a little bit. The apr_global_mutex_* functions turn into two separate syscalls, with #if APR_HAS_THREADS around the thread mutexing. So unfortunately they wouldn't save us any syscalls :-( :-( But they might save a little bit of function call overhead.

Another interesting place to look is in srclib/apr/include/arch/unix/apr_private.h .
There are several xxxx_IS_GLOBAL symbols for various serialization mechanisms. On my Linux box, all of them are #undef'ed and commented out, including fcntl and flock which are the two choices for apr_file_lock. Madhu, could you take a look there and see what you've got?

You really shouldn't use those xxxx_IS_GLOBAL symbols for anything outside of APR.
They are there for platforms like s390 where some of the file-based locks do actually
serialize multiple threads within multiple processes.


If you're worried about the overhead of calling pthread_lock and pthread_unlock
under the covers when it's not needed (like on the prefork MPM) then I would
say that's not a big problem. Locking mutexes that are not contended for can
be quite cheap, and often those calls do not even translate into syscalls.


-aaron



Reply via email to