Squeak: processes and threads

David T. Lewis lewis at mail.msen.com
Fri Sep 22 10:52:57 UTC 2006


On Tue, Sep 19, 2006 at 11:07:22AM -0400, Bert Freudenberg wrote:
> YAKOV wrote:
> >Hi,
> >
> >Where can i find info on processes inside Squeak VM i.e. does it run
> >only one process or multiple processes are allowed; is it possible to
> >use threads. i need it in order to make a VM plugin which is heavely
> >depends on process semantics
> >
> >(i mean process is UNIX process)
> 
> You can fork off as many processes as you like from a plugin, but the 
> interpreter itself is not reentrant. So any work that those helper 
> threads do must be synchronously retrieved from the image through your 
> plugin.

An example of this is the fork and exec primitives in UnixOSProcessPlugin
(in the OSProcessPlugin package on SqueakMap). You can do something
similar to initiate pthreads, but in both cases any update back to
the image must be done synchronously as Bert describes. For example,
when an external Unix process that was started by the plugin completes
execution, the plugin notifies the image by means of signaling a
Squeak semaphore. The Squeak process (Smalltalk process) waiting on
the semaphore wakes up "asynchronously" in the image, but this is
happening with the interpreter thread of the VM, which functions
within a single OS process (and pthread, if threads are being used).

You will also need to consider that other parts of the VM and other
plugins may independently do things with threads or processes.
This could affect things like signal handling in surprising ways.

What are you trying to accomplish in your plugin?

Dave




More information about the Squeak-dev mailing list