Date: Tue, 12 Mar 1996 19:06:55 +0100 (MET) From: Luigi Rizzo <luigi@labinfo.iet.unipi.it> To: leisner@sdsp.mc.xerox.com (Marty Leisner) Cc: msmith@atrad.adelaide.edu.au, questions@freebsd.org Subject: Re: non-blocking read ? Message-ID: <199603121806.TAA20924@labinfo.iet.unipi.it> In-Reply-To: <9603121743.AA08403@gnu.mc.xerox.com> from "Marty Leisner" at Mar 12, 96 09:43:09 am
next in thread | previous in thread | raw e-mail | index | archive | help
> >That's my problem... some programs (noticeably the "harvest" cache) > >work as a single-threaded process which serves concurrent > >requests by trying to avoid blocking calls. It appears to do a nice > >job, but for some things (say reads/seeks etc. from disk) it appears > >that there is no way to avoid delays -- at least to my knowledge. > > How long a "delay" are you having? It's "just" a design problem. If one tries to avoid blocking operations then it would be a shame to be forced to used them. [with current disks, a read issued right after an lseek might get a delay in the 10..100ms range; something that you want to avoid if you have something else to do. Forking a process to absorb the delay might help but is expensive] Someone suggested doing async IO and handling SIGIO (I suppose this refers to doing i=O_NONBLOCK; fcntl(handle, F_SETFL, &i) But I have a doubt: if, afterwards, you do lseek(handle, ...) result=read(handle, buf, size); The lseek might be non blocking -- no problem with that. The read is non-blocking because of the previous call to fcntl(). But how much data will be available when I get the SIGIO (or select will return that I/O is possible) ? The amount I requested (assuming it is available), or the system idea of a block, or what ? Thanks Luigi ==================================================================== Luigi Rizzo Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it Universita' di Pisa tel: +39-50-568533 via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 http://www.iet.unipi.it/~luigi/ ====================================================================
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603121806.TAA20924>