[comp.sys.transputer] Problem with Occam, HELP !

phils@citycs.UUCP (Phil M Sleat) (07/27/89)

I appear to have a problem running an application on a network of
transputers. I would be grateful if anyone can point out what is
probably a glaringly obvious mistake in my Occam code, or perhaps
suggest an alternative solution.

I shall illustrate my problem using the following example. Suppose
I have two transputers connected and wish to have two communicating
processes runnning on them. Instead of directly linking the two
processes together via a logical channel and then assigning this
logical channel to a physical link, I have the two processes talk to
multiplexor/de-multiplexor processes which handle the communication
across the physical link. 

For example on processor 1 the following might be running:

  PROC mux1(CHAN OF prots01 prots01IN, prots01OUT, CHAN OF INT p1c0,
            CHAN OF INT signal)
    INT sig:
    INT v0:
    SEQ
      sig := 0
      WHILE (sig <> 1)
        ALT
          prots01IN ? CASE
            p0p1t0 ; v0
              p1c0 ! v0
          p1c0 ? v0
            prots01OUT ! p0p1t0 ; v0
          signal ? sig
            SKIP
  :
  PROC receive(CHAN OF INT a)
  INT res:
  SEQ
    a ? res
    --
    -- process data
    a ! res
  :

Both of these processes would be called from a master process for
processor 1 which has        

  CHAN OF INT p1c0:
  CHAN OF INT signal:
  PAR
    mux1(prots01OUT,prots01IN,p1c0,signal)
    SEQ
      receive(p1c0)
      signal ! 1
  :

 where prots01OUT and prots01IN are assigned to physical links connected
 to processor 0.

 Running on processor 0 we have a similar set of code:

  PROC mux0(CHAN OF prots01 prots01OUT, prots01IN, CHAN OF INT p0c0,
            CHAN OF INT signal)
    INT v0;
    INT sig:
    SEQ
      sig := 0
      WHILE (sig <> 1)
        ALT
          prots01IN ? CASE
            p0p1t0 ; v0
              p0c0 ! v0 
          p0c0 ? v0
            prots01OUT ! p0p1t0 ; v0
          signal ? sig
            SKIP
  :
  PROC display(a)
    INT res:
    SEQ
      a ! 2
      a ? res
      --
      -- consume results
  :
      
 The processes on processor 0 are called in a similar manner to that on
 processor 1. The protocol prots01 is a simple protocol of 1 tag p0p1t0
 but the intension is to extend it so that more than one process may
 communicate through the muliplexor.

 I've checked the assignment of channels to links and they are okay.
 Indeed in the above simple code when I replace all the processes on
 processor 1 by simple sequential code to accept a number from 
 processor 0 and return a reply, the multiplexor on processor 0 works
 okay. The same is for the multiplexor on processor 1 when I replace
 mux0 by sequential code. The multiplexors appear to function in
 isolation (!) but not together.

 Could it be a problem with the ALT in the multiplexor ? I've tried
 a PRI ALT with physical link communication of higher priority bu that
 doesn't seem to work any better.

 If anyone has any ideas as to why the above doesn't work I'd be very
 grateful. I hope I've included enough information to detail my 
 problem. 

 Many thanks in advance for any replies.

 Phil M Sleat

 phils@uk.ac.city.cs

--------------------------------------------------------------------------
 City University, Computer Science Dept
 Northampton Sq
 London