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

lex at cc.gatech.edu lex at cc.gatech.edu
Wed Aug 4 15:29:46 UTC 2004


Two quick answers.

If you are happy with separate memories and message passing, then you
can use good old fork() and pipes.  Look at the OSProcess package for details.

If you want it to work with shared memory, then I don't think anyone is
working on that in Squeak.  It could be done if you want to invest some
engineering into it.  The main thing that is missing is a thread-safe
object memory.


>      Of course, locks are necessary around structures whose shared 
> memory components may be in flux when another object tries to 
> interrogate it.  But Squeak's message-passed requests are more polite 
> than conventional function calls to object methods, and this can 
> facilitate a more polite "be with you in a few microseconds" response if 
> something is locked than a simple fail. Of course, not all classes and 
> methods and SqueakVM threads are suitable for forking into OS and 
> processor threads.  Those that are or aren't can be tagged with one bit 
> (maybe call it "isSMPThreadable").

In practice, it is VERY hard to achieve proper locking for shared memory
threading, even in tiny programs.  So don't go down that path without a
good reason -- after all, do you care how fast the answer is computed if
it may have been garbled?

Polite message passing is much easier to get right.



-Lex



More information about the Squeak-dev mailing list