OEP

101

Title

Variable replicated PARs

Summary

Allow PAR replicators to have a variable count field.

Owner

Fred Barnes <F.R.M.Barnes@kent.ac.uk>

Status

Accepted

Date-Accepted

2001-10-01

Keywords

language replicators par

This new feature allows for PAR replicators to have a variable count field. This uses the dynamic memory support provided by the run-time system. A simple example of this is:

PROC foo (CHAN INT in?)
  INT count:
  SEQ
    in ? count
    PAR i = 0 FOR count
      some.process (i)
:

In order to help support this, dynamic MOBILE []CHAN arrays are allowed, but no checking is performed on them when used with a replicated PAR. Run-time checking will probably be added at some point.

An example of this type of usage (to build a pipeline of processes) is:

PROC sort.pump (VAL INT size, CHAN INT in?, out!)
  IF
    size > 1
      INITIAL MOBILE []CHAN INT pipe IS MOBILE [size - 1]CHAN INT:
      PAR
        sort.cell (in, pipe[0])
        PAR i = 0 FOR (size - 2)
          sort.cell (pipe[i], pipe[i+1])
        sort.cell (pipe[size-2], out)
    TRUE
      sort.cell (in, out)
:

OEP/101 (last edited 2007-09-26 23:46:13 by ats1)