home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / parallel / 2823 < prev    next >
Encoding:
Text File  |  1992-12-28  |  4.8 KB  |  101 lines

  1. Newsgroups: comp.parallel
  2. Path: sparky!uunet!gatech!hubcap!fpst
  3. From: nikhil@crl.dec.com (R.S. Nikhil)
  4. Subject: Re: (comp.lang.functional) tree of frames
  5. Message-ID: <1992Dec28.182105.9329@crl.dec.com>
  6. Keywords:  tree of frames ...
  7. Sender: news@crl.dec.com (USENET News System)
  8. Organization: DEC Cambridge Research Lab
  9. References:  <1992Dec23.140907.21427@hubcap.clemson.edu>
  10. Date: Mon, 28 Dec 1992 18:21:05 GMT
  11. Approved: parallel@hubcap.clemson.edu
  12. Lines: 87
  13.  
  14. In article <1992Dec23.140907.21427@hubcap.clemson.edu>, sreedhar@cs.mcgill.ca (V.C. SREEDHAR) writes:
  15. > Hello:
  16. > I read in PRISC (Nikhil and Arvind) that they support 
  17. > tree of frame for function invocation.
  18. > In a stack model it is much simpler to manage the stack of
  19. > frames. For supporting tree of frames  one has to
  20. > allocate space from the heap. This could an expensive operation.
  21. > Also how does one manage the run time heap.
  22. > How does one compile programs to  support tree of frames.
  23. > In terms of storage space management, I find difficult to
  24. > understand  management of tree of frames (unlike
  25. > in stack based model,  which is simple to implement).
  26.  
  27. As one of the persons named above, let me respond:
  28.  
  29. - The tree structure is present in any parallel model.  Many parallel
  30.   languages use a ``cactus stack''.  A tree of frames is the same
  31.   thing, except at a finer granularity, where branching may occur at
  32.   each frame.  In this sense, neither model is ``simpler'' than the
  33.   other.
  34.  
  35. - If you are implementing a programming language that has GENERAL
  36.   higher-order functions, you need a tree of environment frames anyway
  37.   (even if the language is sequential, even if you use cactus stacks).
  38.   A tree of frames can be used to handle both parallel calls and
  39.   general higher-order functions.
  40.  
  41. - In the cactus stack model, the stacks themselves have to be
  42.   allocated from some free space.  This may be a general heap that
  43.   includes heap data structures, or could be from special space
  44.   reserved for stacks.  Exactly the same choices can be made with a
  45.   tree of frames--- allocate from the general heap, or from a special
  46.   ``frame store'' area.
  47.  
  48. - In the cactus stack model, the following actions can be expensive:
  49.   a) allocating a new stack (e.g., large object, load balancing issues)
  50.   b) handling the exception when (if) a stack overflows and needs to be enlarged
  51.   c) migrating an entire stack (for load balancing)
  52.   Some of these can be easier to manage at the granularity of
  53.   individual frames.
  54.  
  55. - Reclaiming stack space is easy.  Stacks also contribute to good
  56.   locality.  Trees of frames have exactly the same properties:
  57.   - it is easy to compile frame-reclaimation code inline (does not
  58.     have to rely on a general heap garbage collector) and, further,
  59.   - frames can be therefore be recycled quickly to improve locality
  60.     (even if they are placed in a general-purpose heap)
  61.  
  62. Thorsten von Eicken adds:
  63.  
  64. >    I think the major cost in tree-of-frame allocation is in argument passing
  65. >    and not so much in the heap allocation itself (if well done). You can't
  66. >    pass arguments in registers easily (tree of frames implies parallel call).
  67. >    Arguments have to be stored relative to the newly allocated frame. You also
  68. >    have to pass an invisible `return pointer' so that the child knows where to
  69. >    deposit result values (and what continuation to enable).
  70.  
  71. but I disagree.  Trees of frames support parallel calls, but they do not IMPLY a
  72. parallel call.  A tree of frames can be used in a sequential implementation, and a
  73. tree of frames can have long chains of calls (it does not HAVE to branch at every
  74. frame).  In those situations where you could pass args/results in registers using a
  75. stack model (i.e., local calls/returns), you can do exactly the same thing with a tree
  76. of frames.  The main thing is that you have to know that it's a local call/return, but
  77. that's a language/compiler issue, and trees of frames take no position on that.  I
  78. note in passing that SML of NJ allocates its frames in the heap even though it is a
  79. sequential language and a uniprocessor implementation.
  80.  
  81. So, to get back to the original question of whether stacks or trees of
  82. frames are ``simpler'' or ``better'', this is something that we can
  83. never answer in the absolute, because it depends on everything: your
  84. programming language, your compiler, your run time system, your
  85. architecture, and, ultimately, your application program and its
  86. specific inputs.  So, it can only be answered by experience and, on
  87. that dimension, I think it is still too early to tell.
  88.  
  89. The following reference has more details about compiling a higher-order
  90. functional language for a fine-grain parallel model using a tree of frames.
  91.  
  92.     "The Parallel Programming Language Id and its Compilation
  93.      for Parallel Machines",
  94.     R.S.Nikhil, CSG Memo 313, MIT Laboratory for Computer Science,
  95.     545 Technology Square, Cambridge, MA 02139, USA, July 30 1990.
  96.  
  97. Rishiyur Nikhil (nikhil@crl.dec.com)
  98.  
  99.