I have finally written a program that actually works demonstrating two jobs writing to
channel #2 concurrently.
I have, though, cheated a bit by using the multitasking job "clock" to prove a point. The program shows that
concurrent writing is technically possible but with one job written in assembler. What CLOCK does to make this possible is not
knowable by me.
The program demonstrates two daughter jobs and two channels working in the QD way. The jobs and
channel menus show
correct operation. Both programs need to be compiled with windows turned off and the sound program needs to be referenced
according to its file name.
The sound job uses the keyword WAIT because PAUSE opens a
channel by default thus damaging the display.
I have tested the demo in QPC2 and find that it works just as well as in a Q68.
I don't really know how to send the WAIT code on this forum. The code I have attached were .rts or .cde files.
When I tried to attach the files I got an error saying wrong file type, also don't know how to convert an SMS screen image such that I can post it on this
forum so I have taken a photograph of the display instead.
The Photographs shows the source code in two QDs and the resulting compilation in a small window on the left. The Laptop is an elderly Lenovo X220.
The code for the main job is as follows:- Note the rems have all appeared in the wrong place. See rubbish photo for correct layout.
Is any of this important? I think so because if Peter Graf can be convinced to carry on developing his multi core FPGAs, I can foresee a time when huge FPGAs
are so cheap that it will be possible to create SMS systems with multi core/memory systems and thus prove that Tony Tebby's view that shared memory
systems are not the future of multiprocessor computing.
The ability of multi core SMS computers (or currently networked Q68s) to concurrently solve problems would seem to be useful.
Def_integer p,n,a,s :rem must be on first line (I think)
rem +++++ THREE CO-OPERATING JOBS TWO JOBS WRITING TO #2 CONCURRENTLY +++++
rem ---------- Open and define two display channels #1 and #2 ----------
Open #1,con_
Outln #1,300,130,40,256
Cls #1 : Ink #1,7 : Border 1,7
Open #2,scr_
Window #2,145,35,115,275
Paper #2,7 : Ink #2,0 : Cls #2
Border #2,1,5
rem ---------- end section ----------
rem ---------- Create two daughter jobs ----------
Clock #2,"$d %d $m %c%y %s" :rem clock #2,"$d %d $m %c%y %n.%m.%s"
Qx win3_ticktock :rem make sound job
rem ---------- end Section ----------
rem ---------- Program loop ----------
rem << do not place a :rem after IF statement >>
Rep p
If s=0 : s=1 : Else s=0 :rem sets state of switch
b$="" : c$="" :rem define strings
At #2,1,1 : Print #2," " :rem clears #2 on -
At #2,2,1 : Print #2," " :rem window resize effect
For n=1 To 10
a$=Chr$(Rnd(65 to 90))
b$=b$&a$ :rem creates two random strings
c$=a$&c$ :
End for n
At #1,7,19 : Print #1,b$
At #2,2,7 : Print #2,c$
At #1,9,17 : Print #1,"Press x to quit" :
If s=0 : At #2,0,19 : Print #2,"TICK" :rem print to #1 and #2
If s=1 : At #2,0,19 : Print #2,"TOCK" :
k$=Inkey$(#1,50)
If k$="x" : Exit p :rem exit program
End rep p
rem ---------- End program loop ----------
The code for the sound job is as follows:-
Def_integer p,n
rem +++++ TICKTOCK SOUND FOR CONCURRENCY DEMO +++++
rem ---------- Program loop is endless ----------
rem << use beep by trial and error use as daughter job>>
Rep p
If n=100 : n=150 : Else n=100
Beep 2000,n
Wait 50
End rep p
rem ---------- End program loop ----------