[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mobile variables
Richard Beton wrote:
> Date: Thu, 24 Jun 1999 14:03:46 +0100
> From: Richard Beton <rdb@xxxxxxxxxx>
> Organization: Roke Manor Research Ltd
> To: occam-com@xxxxxxxxx
> Subject: Re: Mobile variables
> .....
> Lawrence Dickson wrote:
>
> > What happens if the variable you are passing around
> > is a part of a larger array, created by abbreviation?
> > Then when the process block exits the scope of the
> > abbreviation, isn't its parent array fragmented?
> > Larry
> > I thought of something like this a couple years ago,
> > but it seemed it would require an "Independent of
> > Abbreviation" checking, which would complicate
> > separately compiled procedures and the like.
>
> I'm not quite sure I understand the question, so I'll probably reveal my
> ignorance, but here goes...
>
> One of the key features of occam abbreviations is that they allow a
> process to alter the contents of a well-defined region of an array
> without actually fragmenting the original array - the abbreviated part
> is still a subset of the whole. Therefore, passing array abbreviations
> as mobile variables would seem like an eminently sensible thing to be
> doing. 'Mobile' variables are only mobile in the sense that their
> 'ownership' moves between processes, whilst the data itself remains in
> the same memory locations, thus avoiding copying operations.
If I remember the notation used right - here is the problem (ch is
declared way farther back somewhere):
[3]INT array:
SEQ
INT x IS array[1]:
SEQ
ch ! VAR x
Now, when the abbreviation goes out of scope, and array is reassembled
from its parts, the middle is missing (is in the scope of some parallel
process outside the declaration of array).
>
> The challenge is to work out how to ensure that different processes
> operate on disjoint (abbreviated) parts of shared arrays. This is much
> easier with occam using abbreviations than with any other mechanism I
> know of, but is still non trivial.
>
> 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
No argument there. It seems though that with mobile variables you have
to have a kind of garbage collection that moves all the pointers to their
original home before going out of scope.
My idea of a couple of years ago was
ch ?! [whatever FROM a FOR b]
executed on both sides of a bidirectional channel, exchanging the pointers
for local copies of whatever. It has the same difficulty if whatever is
an abbreviation.
Larry