[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OCCAM, JOYCE, SUPERPASCAL AND JAVA



Denis A Nicole wrote:
<snip>
The memory management story is also simple.  You calculate at compile time
the size of an activation record for each different recursively used
process.  The compiled code then manages a separate list of exact-size
buffers for each recursively used process. In-line code picks a buffer
from the list on process activation (or sbrk()'s a new one if the list is
empty) and returns the buffer to the list on process termination.  No
buffers are ever returned back from these exact-fit lists. The buffer
lists just grow out of contiguous free store.

The total memory required is bounded, and is optimal if there is only one
recursive process---the typical teaching scenario. It all gets returned at
program termination.

Can I ask a [dumb] question?
What is the difference in what Denis' solution achieves between recursive functions and unbounded PAR statements?

To illustrate my question by example, what I mean is

INT FUNCTION factorial (VAL INT n)
  INT result:
  VALOF
    IF
      (n = 1)
        result := 1
      (TRUE)
        result := n * factorial (n-1)
    RESULT result
:

and an unbounded PAR statement:

INT n:
SEQ
  ...  compute value for n
  PAR i = 0 FOR n
    ...  do lots of things concurrently

Does Denis' solution apply equally to both, or are they different problems?

Rick
--
Richard Beton B.Sc. C.Phys. M.Inst.P.
Roke Manor Research Limited (http://www.roke.co.uk/)
--------- Standard Disclaimer about my own views etc etc --------
---------  My mail client accepts rich text (HTML) mail  --------
Welsh Highland Railway: http://www.whr.co.uk/WHR/WHR.html