Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!ucsd!ucbvax!rt.eltn.utwente.nl!sun From: sun@rt.eltn.utwente.nl (Johan Sunter) Newsgroups: comp.sys.transputer Subject: Re: Anarchic protocol ANY (occam2) Message-ID: <9105161505.AA01949@rt.el.utwente.nl> Date: 16 May 91 15:05:35 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 39 The problem lies in the fact that process 1 tries to iniate 7 communications while process2 will only listen to three. By the way, I compiled the problem on our Meiko In-Sun system using Ops and noticed that process 1 does not terminate, and process 2 does! This consistent with the previous remark, since the first three communications will succeed. However, it is not known in advance how many bytes will actually be copied, this is dependent upon who is first. The proper way to send these kinds of messages is to use buffers in both processes and to use RETYPES to write the variables into and read them from the buffer. Something like this: PROC process.1(CHAN OF ANY to.p2) [100]BYTE buffer: INT s, h1, h2: SEQ REAL32 r RETYPES [buffer FROM 0 FOR 4]: INT i RETYPES [buffer FROM 4 FOR 4]: BOOL b RETYPES [buffer FROM 8 FOR 1]: REAL64 x RETYPES [buffer FROM 9 FOR 8]: SEQ r := 1.5 (REAL32) i := 1 b := TRUE x := 3.1516 (REAL64) s :=17 -- size of message text in bytes h1, h2 := 0, 0 to.p2 ! h1; h2; s::buffer : Notice the channel parameter in the heading! Global channels are definitely not the way to go! Johan Sunter University of Twente Enschede, Holland, EE Dept., Control Laboratory sun@rt.el.utwente.nl