httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@helios.de (Jens-Uwe Mager)
Subject Re: Question: mmap und shared mem
Date Fri, 21 Aug 1998 16:48:26 GMT

>> But there may be other problems with mmap versus shmat, namely virtual
>> address aliasing. Some processor architectures (PA-RISC, POWER/PowerPC)
>
>Interesting.  We use shmat on HPUX, and mmap on AIX.  In both cases we
>don't do a thing after fork(), we use the same handle that was returned in
>the parent.  HPUX has to handle this or it wouldn't be implementing posix
>fork semantics properly... but it does point out a possibility for a speed
>improvement should someone care to put the work into it.

Sharing the mapping through a fork is not the problem as both processes
inherit all mappings (and thus virtual addresses) across the fork.
Mmap'ing the same file at different virtual addresses is the problem
for these architectures. Say if you have two applications (appA and
appB) each map two files (fileA and fileB), but in a different order.
AppA starts with fileA, appB starts withe fileB. Later appA mmap's
fileB, but the virtual address space fileB uses in memory (as mapped by
appB) is already in use in appA due to the mapping of fileA. That is
where the virtual address aliasing conflict comes in.

>Linux 2.1.110 and later, hpux 10.x, and supposedly solaris 2.7 all have
>sendfile() variants... which are (usually) faster than mmap for one-shot
>reads.  sendfile() should also be faster in the cases where you've got
>enough file descriptors to keep handles to all the files you want to send. 
>Main reason is that sendfile() doesn't require any v->p mappings to be set
>up. 

I agree sendfile et. al. is definitely the way to go to push file
contents to clients, but I also look at the problem from an image
processing view. I definitely find it more comfortable to mmap a tiff
file to parse the contents as opposed to the myriad of lseek/read
combinations it would take otherwise.

Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Germany

Phone:		+49 5131 709320
FAX:		+49 5131 709325
Internet:	jum@helios.de

Mime
View raw message