From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,47a06d19e281eb8d X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,47a06d19e281eb8d X-Google-Attributes: gid1164f8,public X-Google-Thread: 111731,47a06d19e281eb8d X-Google-Attributes: gid111731,public X-Google-ArrivalTime: 1994-03-12 12:24:36 PST Xref: gmd.de comp.os.vms:42307 comp.sys.dec:14292 comp.unix.advocacy:1128 Path: gmd.de!newsserver.jvnc.net!news.cac.psu.edu!news1.cac.psu.edu!ECLD.PSU.EDU!BJJ From: bjj@ECLD.PSU.EDU (Bryan J Jensen) Newsgroups: comp.os.vms,comp.sys.dec,comp.unix.advocacy Subject: Re: Does UNIX do async i/o? Date: 12 Mar 1994 20:24:36 GMT Organization: Penn State Engineering Computer Lab Distribution: world Message-ID: <2lt8e4$ia2@genesis.ait.psu.edu> References: <1994Feb26.204059.4068@mixcom.mixcom.com> <11MAR199400234346@hearts.aces.com> <1994Mar11.144337.13745@inmos.co.uk>,<1994Mar11.190110.20289@integrity.uucp> <2lqrtk$99p@gap.cco.caltech.edu>,<2lrev2$q4u@news.utdallas.edu> <2lrgl0$nav@gap.cco.caltech.edu>, Reply-To: bjj@ECLD.PSU.EDU NNTP-Posting-Host: ecld.psu.edu In article , rockwell@nova.umd.edu (Raul Deluth Miller) writes: >On those unix systems where "true asynch I/O" or "true [kernel] >threads" haven't been implemented, it's possible to achieve most of >the benefits of asynch i/o using select (synchronous multiplexed i/o) >in conjunction with non-blocking (polling) i/o. I recently had the opportunity to program under the toy version of UNIX - Linux. Prior to that my experience was limited to VMS. I used "select" and non-blocking I/O to manage my terminal and network I/O. It worked well. Then I found I had to create some processes. UNIX requires the parent process to do a "wait()" on the child process before it will terminate a child. Since I can't wait around for processes to finish, I need some mechanism to let me know when a process terminates so that I can safely do the wait to complete its rundown. Unfortunately, "select" may only be used to wait for certain types of I/O to complete - it can't be used to wait for child process termination. "wait" can be used to wait for any process to complete, but it can't be used to wait for I/O to complete. My suspicion is that I can use signals, and pause till either a process completes or I/O completes. However, I'm still searching for a sufficiently complete description of UNIX to find out how. Linux man pages seem quite inadequate for this, and Sun only somewhat better. VMS seems to win in this situation because various synchronization methods were originally included with VMS (event flags, async traps, and hibernate). As a result, pretty much everything uses one or more of these facilities (with some notable exceptions - queue manipulation, UCX name resolver, and RMS file opens). UNIX, on the other hand, patched async facilities in later, which seems to be in keeping with the general haphazard nature of UNIX (that's not really a criticism - diversity is politically correct these days). >You do have to do a bit of queue management, but that's easy compared >to issues like race conditions [which don't go away when you go to >kernel support for asynch i/o]. But that's still an aside. Yup, I did find the wait queue management easy under UNIX. An aside on races, I was amused by the following comment in Linux (tty_io.c): * This is so ripe with races that you should *really* not touch this * unless you know exactly what you are doing. All the changes have to be * made atomically, or there may be incorrect pointers all over the place. Judging by all the bugs in Linux, I'd say the authors should never have written the code to begin with. Often times, a little forethought can eliminate most possibilities for races, particularly in something like an operating system where a bit of extra overhead or response delays are not critical. An understanding of what's going on while coding can eliminate most of the other race conditions. I suspect the Linux authors skipped the forethought and have been slow to understand what they're doing. >I've still not seen a discussion of the VMS library design where, in >essence, all VMS i/o is done with what would be an ioctl() under unix, >and there's all these useless arguments to be specified even in simple >cases where they're not needed. Seems to me that VMS is providing a >low-level mechanism here, with all that implies. I do agree that VMS system calls are painful, taking away some of the joy of programming. But then, my first experience was TOPS-10, which has far more friendly system calls then UNIX. I think the one thing that hurts most under VMS is that all system calls return a status code. As a result, programmers feel obligated to test for errors. Contrast that with UNIX where errors are rarely checked, with the resulting frequent core dumps on null pointers. So it's really just a tradeoff between developement time and reliability. Actually, I think TOPS-20 had the right idea. System calls return error status, but if you don't put in a check for them, the operating system will bomb your program with an appropriate error. >Which brings me back to my judgement that Unix provides a lot more >("higher level") modularity than VMS. Or, most of the benefits of VMS >have to do with it providing a lower level machine interface. >[Flashback to the "assembly" vs "high level language" wars of >yesteryear.] It's also fair to see that VMS provides a higher level interface then UNIX. RMS' indexed files are a good example of that. I don't think you meant to use the word modularity though - VMS kernel provided support is the uncontested winner in modularity. But that's another story.