You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1998/08/21 12:50:58 UTC

Question: mmap und shared mem

I've currently fiddling with shared memory stuff I want to add to mod_ssl in
the future. It's a total mess because of portability, of course.  (can be also
seen by our #ifdef's in http_main.c ;-). I've now just a question to make sure
I understand mmap() correctly in this context:

When I use shmget/shmat/shmdt/shmctl all my processes can read and write in
parallel as long as I syncronize them for writing with a mutex. But when I use
mmap (should be independed of the anonymous mmap or the /dev/zero variant) the
things are more complicated: When processes mmap a file they can read and
write (again with a mutex for writing, of course) while all immediately see
the change as with shmget & Co, right? But when using mmap to read a file
which is written via write() by another process the mmap'ed version doesn't
change, right? Because this seems the main drawback of mod_mmap_static.c IMHO,
BTW.

So, when the above is right, is this mmap-behaviour ("mmap is similar to shm
as long as all processes to mmap the same way but it's different when the
mapped file is changes directly") _PORTABLE_? According to our http_main.c and
ap_config.c it seems "portable". But I cannot find any documentation on this.
No Unix hacking book says this, so I'm a little but confused. But I want to
make sure it works this way.

Any clarification is welcome.
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com