On Thu, Jul 17, 2008 at 2:07 AM, Charles Forsyth <[EMAIL PROTECTED]> wrote:
>> I could imagine that databases use mmap() havily
>
> it's a little mystery for me why they would do that since it's slower


Well, depends. Non-mmap you have to do the storage management in the
app. mmap, you're using the storage management in the kernel to figure
out where the data goes, as well as all the LRU stuff to figure out
what happens when you're running out of memory and you need to get rid
of some of it.. Most kernels do a better job than most people at this
sort of thing (at least from code I've seen).

mmap can also reduce memory pressure, since there's only one copy of
the data (for some kernels anyway; others are smarter).

In a number of kernels, the read path for page-aligned page-sized data
is via mmap anyway, so any measurement at that point is going to make
mmap look cheaper. Even the read path is an mmap!

Looking at the Plan 9 exec path it's hard to see a reason that Plan 9
could not do mmap, it just doesn't. But lots of code nowadays depends
on mmap being there. Is there something I'm missing?

ron

Reply via email to