home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / dylan / 117 < prev    next >
Encoding:
Text File  |  1993-01-22  |  5.2 KB  |  116 lines

  1. Newsgroups: comp.lang.dylan
  2. Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!sol.ctr.columbia.edu!eff!world!jsidlo
  3. From: jsidlo@world.std.com (John R Sidlo)
  4. Subject: Re: GC Metering Module
  5. Message-ID: <C19nFy.584@world.std.com>
  6. Organization: The World Public Access UNIX, Brookline, MA
  7. Date: Fri, 22 Jan 1993 17:33:33 GMT
  8. Lines: 106
  9.  
  10. I've been following the thread on GC Metering Modules, and have some
  11. observations and comments on the idle loop gc scenarios (I came up with
  12. a similar one), on allocation-area-lists and their interface, and to
  13. persistent storage allocation.
  14.  
  15. With respect to the idle loop scenarios, Allard writes:
  16. > As you say, the form in the event loop would need some refining to avoid
  17. > calling the garbage collector needlessly, perhaps something like the following.
  18. > Please forgive the Common Lisp usage where I have no Dylan equivalent.  This
  19. > form also assumes there is a way to exit a get-event call at the appropriate
  20. > interval into an idle period.
  21. >   (bind ((ephemeral (first (allocation-areas)))
  22. >          (static (last (allocation-areas)))
  23. >          ((available-bytes integer) (area-available ephemeral)))
  24. >     (when (or (< available-bytes maximum-bytes-needed-per-event)
  25. >               (and (not (id? ephemeral static))
  26. >                    (> (- (get-universal-time) last-event-time)
  27. >                       idle-enough-to-gc-interval)
  28. >                    (< available-bytes (/ (area-size ephemeral) 2))))
  29. >       (garbage-collect ephemeral)))
  30. >  
  31. I note that I've independently come up with a similar scenario with some
  32. different wrinkles, plus some comments.
  33.  
  34. First, it seems that an interface to a garbage collector could be
  35. machine independent, assuming that the units of measurement are
  36. primitive enough, perhaps in number-of-bits.  David Moon suggested that
  37. a garbage collector he was considering might not work with the
  38. primitives Allard originally defined.  Allards second note, in
  39. particular the quote below about the ordering and catagories of
  40. allocation areas contained in the allocation list, prompted some
  41. thoughts.  One might imagine an <allocation-area-list> class with a
  42. variety of methods that help ensure portability.  These methods might
  43. include those that iterate over the allocation-areas according to some
  44. special ordering or filter, to subset the allocation-areas, to
  45. garbage-collect all appropriate allocation areas.  The aim of these
  46. interfaces would partially be to ensure the possibility of portability.
  47.  
  48. Second, I agree there could be some additional refinement supporting
  49. when to trigger a garbage collection.  An application event loop is
  50. likely to be in a position to recognize when it seems to be idle. 
  51. Similarly, it should be possible for that event loop to have a decent
  52. idea whether or not real work has been done since the last garbage
  53. collection.  Moreover, if the application could ask the system how busy
  54. it is, something like the following could appear at the end of the event
  55. loop:
  56.  
  57. (...
  58.   (if (and (i-have-been-idle) 
  59.            (idle-time-garbage-collection-is-ok theSystem))
  60.            (or (i-have-been-busy-since-last-idle-gc)
  61.                (it-appears-there-is-garbage))
  62.       (gc))
  63.   (yield-to-system)
  64. )    
  65.            
  66.  
  67. Allard's remark:
  68.  
  69. > Another use that I would make of these tools would be to help manage objects
  70. > that I know will be long-lived.  The following could be an allocation function
  71. > that I would use for such an object.
  72. >   (bind ((original-area (selected-area)))
  73. >     (unwind-protect
  74. >       (begin
  75. >         (select-area (last (allocation-areas)))
  76. >         (make long-lived-jumbo))
  77. >       (select-area original-area)))
  78. and his use of "long-lived" prompted another thought on
  79. allocation-areas.  One could imagine an allocation-area representing a
  80. persistent data store, such as an object-oriented database.  Objects
  81. allocated in such an area would live longer than the running
  82. application, and of course might have different gc strategies.  You can
  83. also imagine an application using several different persistent stores,
  84. so there might be a subset of "persistent-allocation-areas" among all
  85. allocation-areas.  To relate this to a point made above, I might like to
  86. inquire as follows:
  87. (...
  88.   (begin ((all-persistent-stores (choose persistent? theAllocatedAreas))
  89.          ...)
  90.   )  
  91.  
  92. Of course persistent-allocation areas beg lots of other issues, such as
  93. transactions, querying, and so on, that are too lengthy to go into in a
  94. short note.  But persistent-allocation-areas should be able to behave
  95. like temporal-allocation-areas.  For example:
  96. (define-class <allocation-are>a (<object>) ...)
  97. (define-class <temporal-allocation-area> (<allocation-area>) ...)
  98. (define-class <persistent-allocation-area> (<allocation-area>) ...)
  99. (define-class <allocation-area-list> (<list> ...) ...)
  100.  
  101. And finally, Allard writes:
  102. > The problem issues I can think of for this approach would be where there are
  103. > different regions for different kinds of objects, instead of different
  104. > lifetimes.  This would shoot the ordering for allocation-areas in the foot, and
  105. > would make area selection be a little weird.  In this case, when an area is
  106. > selected, it could only be used for objects which could be allocated with in.
  107. I'm guessing that some of these problems can be overcome by reordering
  108. or filtering the allocation area lists.
  109.  
  110.