home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.arch
- Path: sparky!uunet!psinntp!ficc!peter
- From: peter@ferranti.com (Peter da Silva)
- Subject: Re: <None> (Should be Open Systems, bloody NEWS system...)
- Message-ID: <id.JY9W.Y64@ferranti.com>
- Organization: Xenix Support, FICC
- References: <1992Dec23.212321.26522@ryn.mro4.dec.com> <id.SQ3W.IB6@ferranti.com> <1367@taniwha.UUCP>
- Date: Wed, 30 Dec 1992 19:07:44 GMT
- Lines: 55
-
- In article <1367@taniwha.UUCP> paul@taniwha.UUCP (Paul Campbell) writes:
- > I once implemented a complete port of Unix that ran within a single VMS
- > process, the Unix kernel ran in a VMS process in supervisor mode, it ran
- > multiple Unix processes in user mode, supervisor mode ASTs were used for
- > Unix 'interrupts' (for example for input characters from terminals, disk
- > IO completeions etc etc)
-
- Sounds reasonable. I'd hate to think of doing it the opposite way.
-
- > >Much of the *C* run-time in *any* language is non-reentrant, and I would
- > >be surprised if the VMS library was any better. If I get an AST while I'm
-
- > Yeah this is a major design flaw in the Unix/C world - an operating system
- > that returns more than 1 thing from its system calls is implemented in
- > a language that only returns 1 thing from a call.
-
- That's not the problem. The problem is that there's all sorts of internal
- state. You mention errno, but that's the least of it. What about the internal
- contents of io buffers? How do you resolve that? You either abandon user
- level buffering (no thanks), or you put a semaphore around every library
- call, or you defer ASTs while in the runtime. That means you get unpredictable
- I/O delays (how long does a read from a serial port take? Could be days), or
- the chance of deadlocks (call printf or WRITE(6,*) in an AST called while
- in a previous call to the same routine). Errno is an easy one!
-
- sigio()
- {
- int save_errno = errno;
- do your own I/O.
- errno = save_errno;
- }
-
- > This doesn't mean that
- > C shouldn't have been used for Unix - just that the API should have been
- > designed differently for example:
- >
- > (act_len, errno) = read(file, data, len);
- >
- > probably should have been done as:
- >
- > errno = read(file, data, len, &act_len);
-
- I like:
-
- token = syscall(args);
- status = get_status(token);
- result = get_result(token);
- discard(token);
-
- Where token is an opaque object. Much more versatile.
- --
- Peter da Silva `-_-'
- Ferranti International Controls Corporation 'U`
- Sugar Land, TX 77487-5012 USA
- +1 713 274 5180 "Zure otsoa besarkatu al duzu gaur?"
-