Thread View: comp.sys.transputer
3 messages
3 total messages
Started by Kenneth Lui
Thu, 27 Apr 1989 19:06
Parallel output on TDS2 for the PC
Author: Kenneth Lui
Date: Thu, 27 Apr 1989 19:06
Date: Thu, 27 Apr 1989 19:06
31 lines
1685 bytes
1685 bytes
I'm just getting the feel of Occam 2 on TDS2. I"ve written some simple SEQtype programs and some ALTtype programs. I'm having some problems with PAR structures. Specifically, I want to write a section of code that would allow two or more parallel processes to output to the screen concurrently. I wanted to see if the output of one process within of a PAR structure would be intermixed with another process. I used the following code fragment: ... PAR SEQ write.full.string(screen,"String from 'a'") newline(screen) SEQ write.full.string(screen,"String from 'b'") newline(screen) ... Needless to say, it doesn't work. All I got was a big blank from the VDT, except one carriagereturn or linefeed. I looked through the example programs in the c:\tdsxampl subdirectory and it uses other predefined functions in c:\tdsiolib\interf.tsr. Hunting through the documentation (which I have limited access to), I read the section that talked about interf.tsr; but it's all greek to me. I kludged around with the functions mentioned, but all my experiments went down the drain... Can somebody offer some hints as to how I might accomplish the above using either userio.tsr, or both userio.tsr and interf.tsr? Thanks very much, Ken tempest@csuchico.EDU
Re: Parallel output on TDS2 for the PC
Author: Link_-_APO
Date: Sat, 29 Apr 1989 03:06
Date: Sat, 29 Apr 1989 03:06
22 lines
1129 bytes
1129 bytes
One way to solve your problem is to create a multiplexor. As the name implied,
the multiplexor will "ALT"ternate between two or more input screen channels
and writes the output to the "real" screen channel one at a time. This
prevents processes from overriding data to the screen channel.
You can write the multiplexor using the ALT construct,such as,
SEQ
WHILE continue
PRI ALT
quit ? any
SEQ
continue :=FALSE
ALT i=0 FOR n
... process input screen channels
Or you could use the scrstream.multiplexor PROC from INMOS-TDS by including:
"#USE interf" statement in your occam program.
Ahn Nuzen
Link Flight Simulation
link_apo@cup.portal.com
Re: Parallel output on TDS2 for the PC
Author: Ian Gorton
Date: Mon, 01 May 1989 01:38
Date: Mon, 01 May 1989 01:38
52 lines
2552 bytes
2552 bytes
In article <1989Apr27.120625.5348@csuchico.uucp>, tempest@csuchico.uucp (Kenneth Lui) writes:
> I'm just getting the feel of Occam 2 on TDS2. I"ve written some simple
> SEQtype programs and some ALTtype programs. I'm having some problems
> with PAR structures. Specifically, I want to write a section of code that
[deleted]
> I used the following code fragment:
> ...
> PAR
> SEQ
> write.full.string(screen,"String from 'a'")
> newline(screen)
> SEQ
> write.full.string(screen,"String from 'b'")
> newline(screen)
> ...
>
> Needless to say, it doesn't work. All I got was a big blank from the VDT,
> except one carriagereturn or linefeed. I looked through the example
Yeah, the reason is that you're breaking one of the fundamental laws of
occam channels. You are attempting to write to the screen channel
from TWO processes simultaneously. This is not allowed, as each channel
may only have one process outputting to it, and one inputting from it.
A library routine is your solution, it's documented in the
PROGRAMMING INTERFACE section of the TDS manuals. The library process you
need is called 'scrstream.multiplexor': it essentially multiplexes output
from a number of channels onto the 'real' screen channel. This sort of
process is frequently required in occam programs.
So, to solve your problem you need,
[2]CHAN OF ANY scr:
CHAN OF INT stop: -- to terminate multiplexor
PAR
scrstream.multiplexor(scr, screen, stop)
SEQ
PAR
SEQ
write.full.string(scr[0], " whatever")
newline(scr[0])
SEQ
write.full.string(scr[1], "something else")
newline(scr[0])
stop ! 22 -- send any value to terminate multiplexor
The added complications come about because it's necessary to terminate
the multiplexor process, and the signal to do this ( stop ! 22 ) must
be sent after EVERYTHING has been sent to the screen.
It should work! Don't forget to include the libraries.
Good luck, Ian Gorton
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads