Please CC any replies to email@example.com. I can't cope with the traffic of
I'm writing a network server. Very simply put it reads requests from a socket
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 of 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 chunk and
start sending that.
-- The Street finds its own uses for technology.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to firstname.lastname@example.org Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:12 EST