Re: Thread implementations...

David Luyer (luyer@ucs.uwa.edu.au)
Fri, 26 Jun 1998 17:03:04 +0800


> On Fri, 26 Jun 1998, Chris Wedgwood wrote:
>
> > > know is limited to sending entire files verbatim onto a socket.
> >
> > sendfile is most useful when you can append or prepend data constructed from
> > an iovec.
>
> But what will be the difference between sendmsg(2)/writv(2) with that
> syscall and syscall with option to prepend/append data? It's not like
> writv will copy less data when combined with such syscall.

But the output is a network socket. If you want to send

DATA
blahblahblah
.

And blahblahblah comes from a file (which, when it was being input, had all
. quoted to ..), then you can do a sendfile() which will send one packet if
you have the ability to add headers and trailers.

Or, you have to do a write()/writev(), sendfile(), write()/writev(), which
ends up (possibly) sending 3 packets. I'm assuming the actual 'file' will
be much larger than this, but the 2 packet overhead remains.

And if you're a web server or proxy server, and have some headers followed
by a file, you don't want to break things up into one more packet unless
you have to - it makes it slower going over the end user's slow little
modem link and use more CPU time at both ends, etc (not to mention an extra
syscall which has a trivial, but not non-existant, cost).

I don't know if the ability to add extra data is a good or bad thing
really. Maybe the strongest point for implementing it is that it is
then more similar to the HP-UX (and NT) syscall, which means it isn't
completely Linux-specific.

David.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu