httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: Question: mmap und shared mem
Date Fri, 21 Aug 1998 15:59:43 GMT


On Fri, 21 Aug 1998, Jens-Uwe Mager wrote:

> reflected in the mmap'ed shared area. I know that Linux did (does?) not
> have a fully working mmap and this could happen. But for example on

It's fully working, it just doesn't implement shared anon mappings.  You
need to use sysv shm, or mmap a file to get shared memory.

> 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.

> 	* To speed up file reading by avoiding the kernel/user copy use
> 	  mmap for large files, but be prepared to fall back to read if
> 	  the mmap fails for some obscure reason.

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. 

Dean


Mime
View raw message