Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Dec 2005 09:39:30 +0100
From:      Cedric Tabary <ced@grumly.eu.org>
To:        freebsd-hackers@freebsd.org
Subject:   mmap() sendfile()
Message-ID:  <20051212083930.GC91837@efrei.fr>

next in thread | raw e-mail | index | archive | help
I was looking at the freebsd port of thttpd and i saw this patch :
/usr/ports/www/thttpd/files/patch-mmc.c

This is some sort of file cache, it works by mmap()ing some files and
keeping the mmap address in a hashtable. I suppose this is used to keep
the file in memory until munmap() is called.

The patch is just removing the mmap() and keeping file descriptors open
for use by sendfile(). But I don't know if replacing the mmap() by
sendfile() has the same cache effect ?!
Keeping the file descriptor open after using sendfile() will keep the
file in memory ??

If it is true, doing a sendfile() on some very big files (even if not
keeping the descriptor open after) will kill the cache ?

Please help me to understand why this patch ? and the difference between
sendfile() and mmap() at the memory or cache level..

Cédric



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051212083930.GC91837>