Subject: Re: mmap (was Re: bin/10625: /usr/bin/cmp)
To: None <tech-userlevel@netbsd.org>
From: Wolfgang Rupprecht <wolfgang@wsrcc.com>
List: tech-userlevel
Date: 07/28/2000 16:32:42
torek@BSDI.COM (Chris Torek) writes:
> - When and why would read() necessarily be any different from
>   mmap()-and-access?  

When you want to write some "fire-and-forget" code?  

In my case I have a 600Meg DB of all the street lat/lon data in the
US.  Ideally I'd also want to append new stuff and edit some of it
in-place as I figure out corrections to the published data.

Right now I do some of this the old-fashioned way with
read/fseek/write and the code explicitly keeping track of what is in
memory and where.

It would simplify the code greatly if I could just map my DB into
memory, have the OS to suck in only the pages the code touched and
have the pages that changed automatically flushed back out at some
later time.  In one case the code is simple enough to inspect for
correctness.  In the other case I basically re-implement a VM in user
space and hope that I didn't pooch the logic.  ;-)

-wolfgang
-- 
       Wolfgang Rupprecht <wolfgang+gnus@dailyplanet.wsrcc.com>
		    http://www.wsrcc.com/wolfgang/
DGPS signals via the Internet  http://www.wsrcc.com/wolfgang/gps/dgps-ip.html