OEP

128

Title

Mobile BARRIER support

Summary

Provide MOBILE BARRIER synchronisation primitive for use with forked processes.

Owner

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

Status

Accepted

Date-Accepted

2005-03-13

Keywords

language barriers mobiles

Mobile barriers are the mobile equivalent of static barriers. These barriers must be explicitly allocated through the use of a special mobile assignment (that follows the style of other dynamic mobile allocation):

MOBILE BARRIER b:
SEQ
  b := MOBILE BARRIER
  ...  use "b"

Unlike static barriers, mobile barriers may be freely communicated and assigned except when extended by a "PAR BARRIER". Extended barriers may not be over-written, but may still be used as the source in assignment or communication. For example:

PROC recv (CHAN MOBILE BARRIER in?)
  MOBILE BARRIER x:
  SEQ
    in ? x
    SYNC x
:

PROC send (CHAN MOBILE BARRIER out!)
  MOBILE BARRIER v:
  SEQ
    v := MOBILE BARRIER
    out ! v
    SYNC v
:

CHAN MOBILE BARRIER c:
PAR
  send (c!)
  recv (c?)

Following the semantics of communication, mobile barriers may be passed to "FORK"ed processes, that can overwrite their mobile barrier parameters even when extended. Mobile barriers may also be "RESIGN"ed in the normal way. For example:

PROC foo (MOBILE BARRIER x)
  SEQ
    SYNC x
    x := MOBILE BARRIER
    SYNC x
:

MOBILE BARRIER b:
SEQ
  b := MOBILE BARRIER
  PAR BARRIER b
    FORK foo (b)
    SYNC b
    RESIGN b
      ...  do stuff without "b"

OEP/128 (last edited 2007-09-27 00:44:50 by ats1)