home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18268 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  2.6 KB

  1. Path: sparky!uunet!noc.near.net!hri.com!spool.mu.edu!think.com!ames!pacbell.com!network.ucsd.edu!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  2. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Give me safe C++
  5. Message-ID: <1992Dec21.095145.13134@ucc.su.OZ.AU>
  6. Date: 21 Dec 92 09:51:45 GMT
  7. References: <1992Dec14.190553.14838@mole-end.matawan.nj.us> <1992Dec17.192301.23525@ucc.su.OZ.AU> <1992Dec17.235544.5983@rd.hydro.on.ca>
  8. Sender: news@ucc.su.OZ.AU
  9. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  10. Lines: 50
  11. Nntp-Posting-Host: extro.ucc.su.oz.au
  12.  
  13. In article <1992Dec17.235544.5983@rd.hydro.on.ca> twriter@rd.hydro.on.ca writes:
  14. >maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  15. >
  16. >>    Next, I feel NO language has addressed the concept
  17. >>of coroutines (except possibly Simula?). C provides
  18. >
  19. >There was (is) a language called Concurrent Euclid which was invented at
  20. >the University of Toronto some years ago.  In my opinion, it addressed
  21. >the problem of concurrency (coroutines) quite effectively.  
  22.  
  23.     In my thinking, processes differ from coroutines.
  24. First, processes operate concurrently, and so must be synchronised,
  25. whereas coroutines use a single thread of control that
  26. swaps back and forward under the control of the coroutines
  27. themselves (transfer of control is explicit).
  28.  
  29.     The other difference is that coroutines share the environment
  30. they are instantiated in. If Unix processes cause the stack
  31. to be duplicated, then coroutines cause the stack to fork.
  32. >
  33. >When the program starts up it immediately creates two processes
  34. >(coroutines) up and down.  The output might look something like this.
  35. >
  36. >1 >2 >3 >2 >3 >4 >3 >2 >1 >0 >-1 >0 >...
  37.  
  38.     Random. Coroutines, on the other hand, are completely
  39. deterministic. They are like subroutines for which the
  40. caller and callee cannot be distinguished. (Or rather,
  41. the distinction is relative).
  42.  
  43. >
  44. >Euclid also provides a means of synchronizing processes using signals
  45. >and conditions although I don't remember enough to describe it.
  46. >
  47.  
  48.     Coroutine are sometimes used to simulate processes.
  49. However a proper coroutine facility would have to provide
  50. the shared memory context and forked local context.
  51. Of course this can be simulated using objects .. but simulations
  52. are not the same as syntax. Inventing a syntax for filters
  53. is not so hard .. but I've never got beyond that. Perhaps
  54. objects are the only general solution?
  55.  
  56.  
  57.  
  58. -- 
  59. ;----------------------------------------------------------------------
  60.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  61.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  62. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  63.