home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / arch / 12005 < prev    next >
Encoding:
Text File  |  1992-12-30  |  2.5 KB  |  66 lines

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