Re: Non-blocking I/O

Chris Wedgwood (chris@cybernet.co.nz)
Fri, 17 Jul 1998 12:34:07 +1200


On Thu, Jul 16, 1998 at 02:43:18PM +0100, Alan Cox wrote:
> > Is there any non-blocking I/O available in Linux ?
>
> Unix has had non blocking I/O since 1978. Man fcntl, selecty and signal

Yeah, but things like:

open("/mounts/scsi6/cache/04/D3/0004D396", O_RDONLY|O_NONBLOCK)

block.

This really sucks because it means we have to write smarter apps. to put IO
like this in another thread or some such and I'm a lazy bastard who would
like to be able to avoid having to do this.

I know a while back someone suggestion we could have kernel threads do this,
which at the time I didn't like the sound of, but since then I've got lazier
and wouldn't be so opposed to having say 5 or so idle/blocked kernel threads
hanging around to do this when required.

Perhaps spawn more of these when the number of free kernel threads gets low
and kill excess threads when the idle numbers get too high. But 5 sounds
about right, as on a fairly busy squid, I usually don't see more than 5
threads in the D state waiting for disk seek or whatever.

Hmm... I guess more importantly, what does POSIX say here about the use of
O_NONBLOCK with open(2)?

-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