Path: utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!ukma!tut.cis.ohio-state.edu!mailrus!iuvax!rutgers!ucsd!orion.cf.uci.edu!uci-ics!venera.isi.edu!raveling From: raveling@vaxb.isi.edu (Paul Raveling) Newsgroups: comp.os.misc Subject: Re: Asynchronous I/O (was generalized bigotry) Message-ID: <7304@venera.isi.edu> Date: 18 Jan 89 18:46:43 GMT References: <19@xenlink.UUCP> <225800108@uxe.cso.uiuc.edu> <2075@scolex> <2766@ficc.uu.net> Sender: news@venera.isi.edu Reply-To: raveling@vaxb.isi.edu (Paul Raveling) Organization: USC-Information Sciences Institute Lines: 57 In article <2766@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: > >Perhaps a standard set of real-time calls can be decided on. A set more >suited to a wider variety of operating systems. Something like: > > token = start_read(fd, buffer, nbytes, timeout); > ... > nread = check_io(token); > ... > nread = wait_io(token); Here's a C rendition of what we did in several systems starting in 1972 that directly addresses this; I'd still recommend something like: #define ANYEVENT 0 #define READ_EVENT_ID xxx /* integer values to uniquely */ #define TIMEOUT_EVENT_ID xxx /* identify events */ struct event_data {...} evdata; /* Generic event data structure */ ... ... ARead (file, &buffer, nbytes, READ_EVENT_ID); SetTimer (timeout, TIMEOUT_EVENT_ID); ... ... evdata = WaitFor (ANYEVENT); /* Or if you prefer, WaitFor (READ_EVENT_ID) or WaitFor (READ_EVENT_ID "|" TIMEOUT_EVENT_ID) or CheckFor (whatever) [don't block] */ switch ( evdata.event_id ) { case READ_EVENT_ID: completion_status = evdata.status; byte_count = evdata.byte_count; ... case TIMEOUT_EVENT_ID: ... } Communicating event data was the basis for scheduling processes in these systems; this proved to be an extremely general mechanism that made it easy to program a LARGE variety of functions using cooperating processes. It was also quite fast: In communicating small amounts of info, such as i/o request or i/o completion parameters, and doing the consequent context switch, the 1975 system (EPOS) was about 10-12 times faster than UNIX V6. --------------------- Paul Raveling Raveling@vaxb.isi.edu