home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / programm / 3317 < prev    next >
Encoding:
Text File  |  1992-12-13  |  2.7 KB  |  56 lines

  1. Newsgroups: comp.programming
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!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: <1992Dec13.221314.26971@nntpd.lkg.dec.com>
  6. Lines: 43
  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: <GARY.92Dec9104702@kuwait.gdfwc3> <1992Dec10.045716.12505@linus.mitre.org> <dak.724201089@messua> <1992Dec13.051634.14815@linus.mitre.org>
  11. Date: Sun, 13 Dec 1992 22:13:14 GMT
  12.  
  13.  
  14. In article <1992Dec13.051634.14815@linus.mitre.org>, crawford@boole.mitre.org (Randy Crawford) writes:
  15. |>
  16. |>>The problems of reentrancy are a bit different from concurrency. 
  17. |>
  18. |>True, but reentrancy is irrelevant unless concurrency in some form (like
  19. |>context switching) is involved.
  20. |>
  21.  
  22.    Untrue.  Consider a module which implements an abstraction of a queue
  23. or other searching structure, which provides a service for iteration on the
  24. data structure.  If you specify the service such that the caller provides
  25. a function to execute for each element in the structure, there is again
  26. a need for reentrancy controls of some fashion.
  27.  
  28.    The reentrancy controls may be as simple as documenting, "Do not attempt
  29. to modify the data structure from the callback function.  If you do, the
  30. world may come crashing down about your ears."
  31.  
  32.    On the other hand, you might try to do something more intelligent and/or
  33. pro-active in the area, either setting a "busy" flag for the data structure,
  34. and/or making a copy of the data before beginning the iteration process.
  35. This takes time and memory.  [I prefer to provide both sorts of interfaces -
  36. ones which are faster but have more operational constraints, and safer ones
  37. which cost more.]
  38.  
  39.    My point is that reentrancy isn't a Boolean valued quality of a particular
  40. service/procedure/function.  You may be reentrant from a signal point of
  41. view, but not from a multi-threaded point of view.  My first example does not
  42. use concurrency according to any definition with which I am familliar.
  43.  
  44. |>
  45. |>| Randy Crawford        crawford@mitre.org        The MITRE Corporation
  46. |>|                                                 7525 Colshire Dr., MS Z421
  47. |>| N=1 -> P=NP           703 883-7940              McLean, VA  22102
  48. |>
  49.  
  50. ------------------------------------------------------------------------
  51. I'm saying this, not Digital.  Don't hold them responsibile for it!
  52.  
  53. Michael J. Grier                           Digital Equipment Corporation
  54. (508) 496-8417                             mjg@ktbush.dec.com
  55. Stow, Mass, USA                            Mailstop OGO1-1/E16
  56.