Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!sgi!
...@patton.SGI.COM
From: j...@patton.SGI.COM (Jim Barton)
Newsgroups: comp.sys.sgi
Subject: Async IO on the 4D series
Keywords: asynchronous IO programming
Message-ID: <27563@sgi.SGI.COM>
Date: 27 Feb 89 18:53:27 GMT
Sender: dae...@sgi.SGI.COM
Organization: Silicon Graphics, Inc., Mountain View, CA
Lines: 216

There have been many requests for asynchronous IO facilities within the
IRIX kernel.  We haven't implemented anything yet, primarily because it
is not truly clear what a correct, easy to use interface should be.  The
Berkeley FASYNC setup on file descriptors is pretty limited, in that you
get a signal when at least one byte is available - there are no provisions
for bigger buffers, signals to multiple processes (except through process
groups) and others.

My contention has always been that IRIX has the power to perform 
asynchronous IO in user-land, without burdening the kernel and forcing
our idea of the proper semantics on people.  This is possible using 
shared processes and trivial programming techniques.

The following program is a runnable example of just such an IO scheme.  The
program sets up an asyncIO slave to read characters from the keyboard, and
then goes into a CPU intensive loop.  As characters are read, the slave
interrupts the master, passing characters to him.  Because I did this
entirely in user land, it was very simple to implement.  The output is a
series of '.' characters (for each completion of the CPU loop iteration)
interspersed with the characters read from the keyboard.  The program will
quit with a ^C (or whatever your interrupt character is).

Comments and discussion on this example, and the whole of asynchronous IO
in UNIX are welcome.

-- Jim Barton
Silicon Graphics Computer Systems    "UNIX: Live Free Or Die!"
j...@sgi.sgi.com, sgi!...@decwrl.dec.com, ...{decwrl,sun}!sgi!jmb

  "I used to be disgusted, now I'm just amused."
			- Elvis Costello, 'Red Shoes'
--
------------------------- cut here ------------------------------
Code