home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / arch / 12060 < prev    next >
Encoding:
Internet Message Format  |  1993-01-04  |  4.2 KB

  1. Path: sparky!uunet!stanford.edu!rutgers!igor.rutgers.edu!zodiac.rutgers.edu!leichter
  2. From: leichter@zodiac.rutgers.edu
  3. Newsgroups: comp.arch
  4. Subject: Re: reentrant
  5. Message-ID: <1993Jan4.095245.1@zodiac.rutgers.edu>
  6. Date: 4 Jan 93 14:52:45 GMT
  7. References: <id.JY9W.Y64@ferranti.com> <C04zn2.A95.2@cs.cmu.edu> <1993Jan2.122544.26198@sei.cmu.edu> <C08qF4.Knz@news.iastate.edu>
  8. Sender: news@igor.rutgers.edu
  9. Organization: Rutgers University Department of Computer Science
  10. Lines: 78
  11. Nntp-Posting-Host: pisces.rutgers.edu
  12.  
  13. In article <C08qF4.Knz@news.iastate.edu>, john@iastate.edu (John Hascall)
  14. writes:
  15. > }>The OS world is moving towards multithreading...
  16. > ...
  17. > Perhaps the research world has been...
  18. > But as far as (popular) commercially available OSes, it would seem not:
  19. >   MS-DOS:  not a chance
  20. >      VMS:  nope
  21.  
  22. The story for VMS is complicated, and an excellent illustration of why
  23. "yes/no" questions can be misleading.
  24.  
  25. There are two senses in which VMS has had something very much like threads
  26. from the beginning.  First, a VMS process has embedded within it four streams
  27. of control, one at each access mode (user, supervisor, executive, kernel).
  28. In the modern sense, these are "threads" in the sense that they have separate
  29. sets of registers, separate PC's, and separate stacks, all within one address
  30. space.  However, they are NOT full threads because they from a strict hierar-
  31. chy, and each access mode, in running, blocks the scheduling of the modes
  32. "outside" it.  Also, in practice, inner-mode "threads" don't really suspend
  33. themselves "at" a PC to allow outer-mode threds to run; they just stop.  When
  34. re-activated from outer modes, they generally start from a fixed PC.  How-
  35. ever, this is not a complete description, because of the second feature,
  36. AST's.
  37.  
  38. AST's (Asynchronous System Traps) are software interrupts.  Each access mode
  39. really splits into two threads, the "normal" level and the "AST" level.
  40. Code running at "normal" level can be interrupted by delivery of an AST,
  41. which then runs at "AST" level, and cannot be further interrupted (except by
  42. code at an inner mode).
  43.  
  44. It is quite possible - and common, in high-performance, interrupt-driven code
  45. - to have all of the work done within AST routines; the "normal" code just
  46. sleeps.  The result looks very much like code written for a system with
  47. threads.  It's not identical, and it's less general; but it's been there
  48. since the late '70's.
  49.  
  50. AST's get hardware support on the VAX, in the form of a "pending AST mode"
  51. register and a check by hardware whenever the access mode becomes less
  52. privileged to see if some previously-blocked AST should now be delivered.
  53. On the Alpha, the VMS PALcode services include AST support.
  54.  
  55. Essentially all system services in VMS that might block have an asynchronous
  56. form.  (The exceptions, some recently "fixed", have to do with things like
  57. opening - not reading, just opening - files.)  The asynchronous forms can
  58. either just set a flag on completion, or deliver an AST (in the form of a call
  59. to a user-specified procedure, passing a user-specified argument).  It is
  60. extremely easy to build threads on top of these services - I did it years
  61. ago, and others have, too - including DEC, for their ADA implementations
  62. among other things.
  63.  
  64. Unfortunately, the asynchronous options of the underlying services are usually
  65. not accessible from various programming language interfaces - e.g., the C or
  66. FORTRAN I/O libraries have synchronous semantics.
  67.  
  68. VMS has also had something called PPL (Parallel Programming Library) as an
  69. official part of the OS for about five years.  PPL is a thread-like package
  70. built on top of multiple processes.  The cooperating processes share SOME
  71. of their memory:  They all execute the same code, and they can allocate
  72. memory from a common heap, but they can also have private heaps.  Threads,
  73. processes, or something else?
  74.  
  75. There's a spec for a supported true threads package for VMS (and OSF); I
  76. don't think it's officially out yet for VMS, but it's been promised.
  77.  
  78. All of which makes Mr. Hascall's distinction:
  79.  
  80. >      VMS:  nope
  81. >     UNIX:  not yet
  82.  
  83. rather curious.
  84.  
  85. (BTW, the earliest thread package, complete in the modern sense, that I know
  86. of in a commercial operating system was in VAX ELN, a real-time OS for VAXes
  87. that DEC has sold since about 1983.)
  88.                             -- Jerry
  89.