[plt-scheme] Parallel execution
I've been working my way through SICP and am currently in chapter 3.
Right now, I'm reading about parallel execution. The syntax they use is
(parallel-execute <thunk> <thunk> ...)
I'm not sure how to do the same thing in PLT Scheme, but I did try
(begin (thread (lambda () (display "A"))) (thread (lambda () (display
"B"))))
and sometimes get "AB" and sometimes "BA" (as I had hoped). So, how
do begin and thread interact? I had expected that I'd see "AB" much
more often than "BA" because I thought each thread would be scheduled
as soon a (thread <thunk>) was evaluated. But now, I wonder how
thread is implemented, and if none of the threads would actually run
until the begin block was evaluated. Then I began to wonder how if
there was just one "engine" (for lack of a better term) carrying out
a single reduction in each thread and then moving on to another
(round robin scheduling?)
Just wondering.
===
Gregory Woodhouse
gregory.woodhouse at sbcglobal.net
"The whole of science is nothing more than a refinement
of everyday thinking." -- Albert Einstein