How can you demonstrate the interleaving of jobs without disturbing it with explicit synchronization? I actually did this in PLT Scheme as follows

(define (the-body x)
  (begin
    (let loop ((i 0))
      (begin
        (if (< i 25)
            (begin
              (display x)
              (loop (+ i 1))))))))
;The use of t1 and t2 here is an artifice to
;suppress display of the thread ID
(define t1 '())
(define t2 '())
(begin
  (set! t1 (thread
             (lambda () (the-body "A"))))
  (set! t2 (thread
            (lambda () (the-body "B")))))


where the output could be (it varies from run to run):

AABBBAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBB

Now, this almost looks like MUMPS. Instead of a named let, I can use FOR, and instead of thread, I can use JOB, so it would seem natural to write something like

JOB BODY("A")
JOB BODY("B")

where BODY is just a FOR loop

BODY(X)  ;
 FOR I=1:1:25 WRITE X
QUIT

But, of course that's not allowed, because background jobs can't write to the terminal. A natural idea is to use a host file instead, but then the test would say more about output buffering than anything else.

Does anyone have any ideas?

===
Gregory Woodhouse
[EMAIL PROTECTED]

"A hero is no braver than an ordinary
man, but he is brave five minutes longer."
-- Ralph Waldo Emerson





-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to