Please CC any replies to agl@linuxpower.org. I can't cope with the traffic =
of
linux-kernel. Thanks.
I'm writing a network server. Very simply put it reads requests from a sock=
et
and replies with the contents of some local file that the client requested.
Currently I mmap the files and then feed it to the socket when select(2)
says it is ready for writing. If another request comes in for the same file
then file the file is already mmap'ed and it's just sent.
If too much data is mmap'ed (user configurable) then the oldest data is
munmap'ed before new data is mmap'ed.
As I understand it mmap and munmap need quite a lot of MM work (setting up
page tables etc). Would it be better if I opened the file and read chunks o=
f it
into memory as needed? Every time the socket is ready for writing I check to
see if the buffer has already been written, and if so, read in another chun=
k and
start sending that.
Thank you
Adam Langley
--=20
The Street finds its own uses for technology.
--ZPt4rx8FFjLCG7dd
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.0 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAjkIC2oACgkQc/sOPsJbMv29IACgvT2ePclYofg3PYmGziFHvZTO
zoMAn3Dimc5Z3pV6FqD5RcS0gOy+F8Ig
=7wu+
-----END PGP SIGNATURE-----
--ZPt4rx8FFjLCG7dd--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/