From: Nicolas N. <Nic...@iw...> - 2006-04-05 20:38:20
|
Hello, I am trying to parallelize my Femlisp application at some important points. Especially, I would like to split the work at some points in the program such that more processors are involved. I have the following questions: 1. Usually, the work to be done depends on information in the lexical environment. But as much as I see threads generally communicate only via special variables, which somehow does not fit very well this task. What was the reason of this choice? Performance? Is there some way how to achieve such a splitting and recombination of threads in a reasonably nice way using the existing mechanisms? 2. Somewhat connected: Allegro's processes can be made to inherit some of the active dynamic bindings (keyword initial-bindings). Is there a possibility to achieve this in SBCL? 3. Is there an idiom for waiting until a thread / several threads has/have terminated? I guess that (loop while (thread-alive-p thread)) is not very efficient... Thank you, Nicolas. |
From: <me...@ho...> - 2006-04-06 07:19:14
|
On Wednesday 05 April 2006 22:36, Nicolas Neuss wrote: > Hello, > > I am trying to parallelize my Femlisp application at some important > points. Especially, I would like to split the work at some points in > the program such that more processors are involved. I have the > following questions: > > 1. Usually, the work to be done depends on information in the lexical > environment. But as much as I see threads generally communicate > only via special variables, which somehow does not fit very well this > task. What was the reason of this choice? Performance? The lambda you pass to make-thread does capture lexical bindings.=20 However, in most cases, the lexical environment in which a thread was=20 created is not around when the other threads it wants to communicate=20 with are created thus globals are used. > Is there=20 > some way how to achieve such a splitting and recombination of threads > in a reasonably nice way using the existing mechanisms? I think splitting is easy, for join see below. > > 2. Somewhat connected: Allegro's processes can be made to inherit > some of the active dynamic bindings (keyword initial-bindings). Is > there a possibility to achieve this in SBCL? Automatically, no. One has to do it by hand and that obviously doesn't=20 work if the thread is created by someone else. > > 3. Is there an idiom for waiting until a thread / several threads > has/have terminated? I guess that (loop while (thread-alive-p > thread)) is not very efficient... Again, you must roll your own with a condition variable I guess. > > Thank you, > Nicolas. Cheers, G=E1bor |