httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <...@engelschall.com>
Subject Re: APR shared memory requirements.
Date Mon, 07 May 2001 12:55:18 GMT

In article <Pine.LNX.4.33.0105061214400.20277-100000@twinlark.arctic.org> you wrote:

>> No, Dean, I think you misunderstood me here. If the shared memory
>> segment is full, I don't want to _replace_ it with a larger one. I
>> just want to _add_ another _new_ shared memory segment to the memory
>> pool and allocate the requested chunk of memory from there instead. The
>> same way a heap-based allocator uses sbrk(2) again and again to get more
>> heap segments I want to allocate more and more shared memory segments.
> 
> oh i know you don't want to grow the existing segment -- but in order to
> add new segments you need to co-ordinate with all processes.  you can't
> accomplish this the same way that anon-mmap() and fork() do -- you need to
> have a handle which all processes can use to open the memory.  that's
> going to be a filename on unixes that don't have sysv shm...
> 
> also, the rest of the problem is that all references to the shared memory
> need to be indirected -- because you can't be sure if the process you're
> running in has the segment you need mapped.

BTW, I thought about all this again and think one can solve these issues in a
portable way: you just allocate a rather large shared memory segmet (or
multiple shared memory segments) at startup, but do not touch the mapped
memory at all until it is actually used.  The idea is that unless you touch
the memory segments they do not cost any real memory, but the memory mapping
is already present in all forked processes from the start. How about this?

                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Mime
View raw message