home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / programm / 3366 < prev    next >
Encoding:
Text File  |  1992-12-27  |  3.7 KB  |  68 lines

  1. Newsgroups: comp.programming
  2. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!news!nntpd.lkg.dec.com!ktbush.ogo.dec.com!mjg
  3. From: mjg@ktbush.ogo.dec.com (Michael J. Grier)
  4. Subject: Re: reentrant code
  5. Message-ID: <1992Dec27.205134.28400@nntpd.lkg.dec.com>
  6. Lines: 55
  7. Sender: usenet@nntpd.lkg.dec.com (USENET News System)
  8. Reply-To: mjg@ktbush.ogo.dec.com (Michael J. Grier)
  9. Organization: Digital Equipment Corporation
  10. References: <1992Dec14.160110.26338@linus.mitre.org> <1484@eouk13.eoe.co.uk> <1992Dec22.050426.17583@linus.mitre.org>
  11. Date: Sun, 27 Dec 1992 20:51:34 GMT
  12.  
  13.  
  14. In article <1992Dec22.050426.17583@linus.mitre.org>, crawford@boole.mitre.org (Randy Crawford) writes:
  15. |>As Mr. Grier put it:
  16. |>> Consider a module which implements an abstraction of a queue
  17. |>> or other searching structure, which provides a service for iteration on the
  18. |>> data structure.  If you specify the service such that the caller provides
  19. |>> a function to execute for each element in the structure, there is again
  20. |>> a need for reentrancy controls of some fashion.
  21. |>
  22. |>Here, reentrancy is necessary only if there are one or more data shared among 
  23. |>these search callbacks to which they might write asynchronously, interfering 
  24. |>with each other's state.  In that case, I still see this as a concurrency 
  25. |>problem (and certainly a reentrancy problem too).  
  26. |>
  27. |>To better define my terms, I think that reentrancy exists to serve concurrency,
  28. |>and as such, you cannot have reentrancy without concurrency, but you can have 
  29. |>concurrency without reentrancy when no shared data is vulnerable.  
  30. |>
  31. |>To pick a nit.
  32.  
  33.    I've put a fair amount of thought into this issue, and while you might be
  34. able to convince me that in some abstract sense recursion and concurrency
  35. are different specializations of a common principle, while I lack a formal
  36. proper definition for concurrency, I would classify the two as separate
  37. concepts.  I believe this is/was my major point personally.
  38.  
  39.    It's a working/engineering style definition rather than a pure theoretical
  40. view, but a definition of concurrency which includes recursion is, IMHO,
  41. in any practical sense, useless or confusing.  (Not useless per se., so much as
  42. that if I was explaining a module in a formal inspection with my peers, and
  43. controls which are of the nature I described earlier -- where a recursive
  44. reentrancy into a data structure could naively cause destructive behaviour --
  45. and I started describing the facets as "concurrency controls" rather than
  46. "recursive reentrancy controls", confusion would reign.)
  47.  
  48.    In a functional (i.e. no destructive assignments) world, the two could
  49. probably be merged successfully, as parallelism and recursion could both
  50. be "implementation details".  In my very real world of thousands of lines of
  51. C and other languages, where the cost of "reentrancy controls" is often
  52. orders of magnitude lower in cost than "concurrency controls", the difference
  53. is very important.  (My current project is layered, and uses a threading
  54. programming model, so both recursion within a thread and multiple threads
  55. coexisting peacefully are concerns.  I'll think more about it, but there is
  56. such a real world difference between recursion and the pseudo-concurrency
  57. granted us by threads that merging the two concepts in a day-to-day world
  58. is inconceivable.)
  59.  
  60. ------------------------------------------------------------------------
  61. I'm saying this, not Digital.  Don't hold them responsibile for it!
  62.  
  63. Michael J. Grier                           Digital Equipment Corporation
  64. (508) 496-8417                             mjg@ktbush.dec.com
  65. Stow, Mass, USA                            Mailstop OGO1-1/E16
  66.  
  67.  
  68.