apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sander Striker" <stri...@samba-tng.org>
Subject APR memory systems, requirements
Date Wed, 09 May 2001 09:45:04 GMT
Hello again,

To implement shared memory systems, locking is required.
Since memory systems are hiding everything from the user,
locking for allocation and freeing is also hidden.
This means that when a user does a global lock, and
then calls apr_memory_system_malloc() on a shared
memory system (or any memory system doing locking)
a deadlock will occur.
So, we are going to need smart, refcounting locking.
The smart part is in identifying the callers process/thread.
If the same caller locks, just bump the refcount and 
return.

I'm not a locking expert and if I read correctly Ryan and
Greg are already on this, but I want to point out that
this is imho the only way to cleanly implement this
in a way a user doesn't have to twist his brain when
using shared memory :-)

Oh, before I forget, there are ofcourse two locking
issues:

 - locking required for management (ie, malloc etc),
   which is done by the memory system (the implementor
   is responsible for this and should document it).
   Effectively a user doesn't see this and shouldn't
   have to worry about it.

 - locking required for accessing the memory.
   The user has to explicitly call apr_memory_system_lock()
   (to be defined and implemented) for this. In
   case of a non locking memory system this function
   just does nothing and returns. In the case of a
   locking memory system the function calls the
   memory system specific lock function (which has
   to be provided by the memory system implementor).


Sander


Mime
View raw message