[Haskell-cafe] Non-blocking I/O (was: Re: Hugs vs GHC)

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Wed Jan 26 14:25:28 EST 2005


Glynn Clements <glynn at gclements.plus.com> writes:

>> > The point is that the Unix documentation does not consider the short
>> > pause as data is read off your hard drive to be blocking. So that's why
>> > select will always report that data is available when you use it with a
>> > file handle.
>> 
>> Isn't this also for historic reasons?
>
> Partly.
>
> But I think that it's also because this functionality wasn't intended
> for the purpose which is being discussed, i.e. enabling a process to
> obtain maximal CPU utilisation.

I think it's also because if we considered reading from a slow file to
be blocking, we should also consider blocking many other calls which
access a disk. In particular anything which takes or returns a filename;
resolving a filename may involve reading a slow disk.

But in these cases the system doesn't know whether the programmer
really intended to do something else while mkdir() is completing,
because mkdir() is not performed on a file descriptor on which
non-blocking mode could have been set or reset.

It would need quite a different API.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Haskell-Cafe mailing list