Subject: Re: heavy use of mmap() ?
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Jaromir Dolecek <>
List: current-users
Date: 04/30/1998 14:40:41
der Mouse wrote:
> > I recall a discussion some time ago about heavy use of mmap()
> > actually _decreasing_ performace of reads from mmap()ped files.
> A while ago, NetBSD had a bug that meant that reads and writes via
> mmap() and accessing the memory were decoupled from reads and writes
> via read() and write().  That is, if you wrote to a mapped memory
> section and then later used read(), you might not see the writes as
> having been done; I assume something similar could happen the other
> way, but I don't recall seeing it tested.  (This is the "unified buffer
> cache" issue - the buffer cache used by read()/write() was a rather
> ugly hack and it didn't cooperate nicely with the VM subsystem used by
> mmap()ed accesses.)

Well, so if the files would be only read (normal situation on Web server),
everything would be okay ? As the web is, any mmap()ed file would be
unmmap()ped within a while, so even in case where Apache would run on "broken"
system, nobody would notice anything.

Am I right using mmap() by Web server would be "safe" in any case ?
Or is there anything I miss ?

> I don't know whether we still have this bug.  I would hope that at the
> very least UVM would fix it, but as I haven't tested for its presence
> under any kernel less than a few months old I can't say about either
> UVM or -current old VM.

I recall someone asking if UVM solves the buffer cache problem and
someone answering "No, but it will be implemented in some point in

Jaromir Dolecek <>
It is better never to have been born.  But who among us has such luck?
One in a million, perhaps.