tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Writing to multiple descriptors with one system call

On Wed, 17 Mar 2010 19:07:29 +0100
Vlad Galu <> wrote:

> That's easy to do with sendfile(), the VFS layer should do the caching
> for you. Since you already mentioned kevent(), I assume you have
> nonblocking I/O in mind, in which case your app won't be considerably
> slown down by the send()/sendfile()/whatever() calls. Yes, you'll do
> it over more context switches, but otherwise what you want isn't
> possible, unless you have a true async I/O system. Even the function
> you wants existed, how could it update the outstanding data counters
> without blocking?

Two problems with sendfile() are:

1. You can't control how kernel caches your file data. It probably uses
LRU algorithms of some sort, but your application might want to have a
better control over which objects are locked in memory and for how long.

2. With HTTP pipelined requests you would probably have to call
sendfile() for each request. If your application caches data directly,
it can issue a single writev().

I think I need to go away and write a function that does what I was
describing and then see if this can be applied to a system call.

Home | Main Index | Thread Index | Old Index