Re: Non-blocking I/O

Chris Wedgwood (chris@cybernet.co.nz)
Wed, 22 Jul 1998 01:42:12 +1200


On Tue, Jul 21, 1998 at 09:34:54AM -0400, Zachary Amsden wrote:

[I reformatted this because you evil nasty mta did bad things]

> Should be very easy indeed, just check for O_NONBLOCK when you are going
> to block a process waiting for disk I/O, and return the number of bytes
> read so far. Of course, all I/Os that you return EWOULDBLOCK on need to
> be scheduled so that at some point in the future they won't block. If the
> buffer cache locks in pages with pending transfer to userspace, I suppose
> it would also be wise to check for misbehaving processes chewing up a
> whole bunch of buffer cache with nonblocking I/O requests that they never
> service with some kind of timeout mechanism on the locks.

For it to be useful, it need to be made to work with select(2) and poll(2)
much the same as sockets do.

This looks decidely difficult to me.... <pause>.

Actually, maybe not. Right now, I'm using a wrapper around libc which uses a
pool of threads for the IO, I could also wrap select and poll in a similar
way...

hmm... what seemed very difficult now doesn't seem to hard. Will see later
perhaps.

-cw

-
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.altern.org/andrebalsa/doc/lkml-faq.html