Questions on Squeak's threading architecture -- why can't Squeak do SMP yet?

John M McIntosh johnmci at smalltalkconsulting.com
Wed Aug 4 21:45:37 UTC 2004


Ed, the VM generated file interp.c has most of the variables in a  
single structure, excluding a few which are initialized arrays or  
involved in a C call out. The few variables about 6 that are defined in  
the scope of interp.c  with an hour or two of work these could live in  
the foo structure thus making the interpreter thread safe if you want  
to run multiple VM threads, each thread being it's own VM and having  
it's own image file. Some simple method, perhaps as easy as allowing  
messages to be passed up on the VM event queues to the image could be  
used to facilitate inter image processing. This could give you a VM  
that could have N images running within it, and cheap message passing  
as compared to other facilities that operate at the OS level. I'd ask  
first if this gains anything over having N VM running under the host OS  
at the same time?

But....

More effort would be required then to make the platform code thread  
safe, some of that uses local scoped or static variables, but you could  
start with a limited set excluding things involving the UI.

However if you wanted to run a smalltalk process on a different thread  
within the same image then:

a) the interp.c code isn't thread safe, assuming each thread uses the  
same foo structure.
b) Smalltalk code within a single image isn't thread safe. This is a  
bit harder to figure out, but I think there are places where the  
smalltalk
process switching rules prevent race conditions which you would uncover  
with multiple processes running. (as others have pointed out).


On Aug 4, 2004, at 5:43 AM, Ed Boyce wrote:

> /delurk
> Hi Squeak devs:
>
>     I have a few questions about Squeak VM architecture, and I  
> apologize for the newbie sounding nature of some of them; I have spent  
> a fair amount of time browsing the Swiki and the System Browser, and  
> tried searching the dev list with google, only to find small snippets  
> relating to my questions about multithreading in the VM.  My  
> motivation has to do with wanting to share physical simulations and  
> visualizations over distributed hardware with Croquet when available,  
> but my questions about scalability seem to be more Squeak VM related.
>
>     What is stopping Squeak from doing SMP?  (or Async MP for that  
> matter?)


> --
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===




More information about the Squeak-dev mailing list