next up previous
Next: Higher-level ranges and locations Up: Introduction to Java-Ad Previous: Distributed arrays


The on construct and the active process group

In the last two section the idiom

  if(p.member()) {
    ...
  }
has appeared. Our language provides a short way of writing this construct
  on(p) {
    ...
  }
In fact the on construct provides some extra value. Informally we said in section 3 that the active process group is restricted to p inside the body of the p.member() conditional construct. As part of the language, Java-Ad includes a more formal idea of an active process group (APG). At any point of execution some process group is singled out as the APG. An on(p) construct specifically changes the value of the APG to p. On exit from the construct, the APG is restored to its value on entry.

Elevating the active process group to a part of the language allows some simplifications. For example, it provides a natural default for the on clause in array constructors. In the matrix multiplication program of the previous section the code

  if(p.member()) {
    ...
    float a [[#,,]] = new float [[x, B, N]] on p ;
    float b [[#,,]] = new float [[x, N, B]] on p ;
    ...
  }
can be simplified to
  on(p) {
    ...
    float a [[#,,]] = new float [[x, B, N]] ;
    float b [[#,,]] = new float [[x, N, B]] ;
    ...
  }
More importantly, formally defining the active process group will simplify the statement of various rules about what operations are legal inside distributed control constructs like on.


next up previous
Next: Higher-level ranges and locations Up: Introduction to Java-Ad Previous: Distributed arrays
Bryan Carpenter 2002-07-12