Clusters, grids and Squeak

Michael van der Gulik squeakml at gulik.co.nz
Wed Apr 20 09:04:45 UTC 2005


David T. Lewis wrote:
> On Tue, Apr 19, 2005 at 10:55:17AM +0100, Darren Hobbs wrote:
> 
>>What might work is starting one headfull image to act as task
>>coordinator, and devise a way to launch a bunch of very cut-down
>>headless 'worker' images.  The kind of client code that I'm imagining
>>might look like this:
>>
>>95 timesRepeat: [GridWorkerProcess new].
>>GridScheduler allWorkersDo:[MyComputeIntensiveGridTask new].
> 
> 
> Try this:
> 
>   | myWorkers p1 p2 worker messageFromSupervisor |
>   myWorkers := (1 to: 95) collect: [:e |
>     p1 := OSPipe nonBlockingPipe.
>     p2 := OSPipe nonBlockingPipe.
>     worker := UnixProcess forkHeadlessSqueakAndDoThenQuit:
>         [(Delay forMilliseconds: 200) wait.
>       messageFromSupervisor := p1 reader upToEnd.
>       p2 writer nextPutAll: messageFromSupervisor.
>       p2 writer nextPutAll: ' received by worker ',
>         OSProcess thisOSProcess pid asString.
>       p2 close].
>       p2 closeWriter.
>       p1 nextPutAll: e asString, ': hello to worker from coordinator ',
>         OSProcess thisOSProcess pid asString.
>       p1 close.
>       Array with: worker with: p2].
>   myWorkers do: [:w |
>     Transcript show: w first asString, ': ', w second upToEnd; cr.
>     w second close].

Be carefull not to modify any code from any of those headless instances 
- the squeak.sources file will end up corrupted. There is no 
multi-threaded protection on it. (I learned this the hard way.)

Also, Squeak is kind of slow for parallel processing, isn't it? Or can 
Expury fix that?

Mikevdg.




More information about the Squeak-dev mailing list