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

[Fwd: Mobile variables]



--
Dr A E Lawrence (from home)
--- Begin Message ---
I have just got back from the UKUUG linux99 conference at Aston, so I
haven't had time to convince myself that no abbreviation problems can
arise with my mobile variables proposal. Abbreviation was certainly not
one of my prime concerns when I was working out the approach except in
so far as it messed parameter passing in procedures. So it is something
which needs close examination. That said, it looks watertight at first
glance.

In between Linux talks, I did scribble a few outline programs in which I
tried to break mobile channels by abbreviations in odd places, but did
not succeed. However, I did find some natural programs a bit awkward to
express using just CLAIM, and so I decided to slightly modify my
proposal using -- guess what -- a special sort of abbreviation.

As I noted in the original version, CLAIM x has two functions:

1) To delimit the scope within which x must be EREW;
and
2) to "capture" x for the first branch if it has not already been
claimed.

An implication of that was that if you wrote an embedded PAR, the CREW
rules applied within that local context, and you had to CLAIM again if
you wanted to have exclusive access in the finer-grained parallelism.
This is rather pleasing with a nice recursive structure.

However, and it is partly connected with the fact that CLAIM v grabs v
for the *first* subprocess, I found some naturally symmetrical patterns
of communication messy to "wire up". Another issue was something like

CLAIM x,y
  c1 ? x
  c2 ? y
where I really didn't want to CLAIM the variables at all. And I then had
to arrange for the transmitter CLAIM to have priority. There are
solutions, but it just looked wrong and complex.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Revision:
~~~~~~~~

I want to separate the two functions of CLAIM, and introduce a MOBILE
abbreviation of the form:
 y IS MOBILE x :

Within the scope of such an abbreviation, y has "dynamic scope"/is
exclusive/obeys EREW. Outside this scope, x obeys whatever usage applies
in outer scope: it might have been subjected to anothe abbreviation.

Notice that all processes with the MOBILE abbreviation scope now
must be compiled for EREW usage.

Now I can write

MOBILE INT x,y :

x IS MOBILE x : -- Usually this might be poor style, but if x and y
y IS MOBILE y : -- are only EREW, maybe this is ok?
CHAN OF VAR x c:
CHAN OF VAR y d:
PAR                      or    CLAIM x
  c ? VAR x                      c ! VAR x
  d ? VAR y                      d ? VAR y
CLAIM x,y                      CLAIM y
  PAR                            d ! VAR y
    c ! VAR x                    c ? VAR x
    d ! VAR y

CLAIM x can only occur in the scope of an MOBILE x abbreviation .
Likewise the declaration of a VAR CHAN transporting x.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

These are just my first ideas for discussion. I need to sleep on them,
and play around a bit more. As far as I can see, this is still
watertight, does not really modify the orginal construction, but does
make it easier to write cleaner simpler code. 
 
Now, is KRoc for Linux 2.2.10 and glibc ready for download...?

Adrian
--
adrian.lawrence@xxxxxxxxxxxxx

--- End Message ---