Squeak and native threads

Jecel Assumpcao Jr jecel at merlintec.com
Wed Jan 10 22:11:19 UTC 2007


Zulq Alam wrote on Date: Sun, 07 Jan 2007 18:14:28 +0000
> I found http://wiki.squeak.org/squeak/537 very interesting on this whole 
> subject. I was especially interested in the work on Merlin/TinySelf 
> where message sending is (as I understand it) asynchronous. I wonder 
> what would be required to spike this in Squeak even if just simulated?

The "wait by necessity" model  in tinySelf 1 was borrowed from a
parallel version of Eiffel. It is a middle ground between true
asynchronous messages and synchronous ones. I think that the model in E
in several other systems are the same. Eiffel made a distinction between
active and passive objects while I tried to have active objects
exclusively in tinySelf 1 (one thread per object). A consequence of this
was that it was easy to have deadlocks - any direct or indirect
recursion would do and this is very common in Smalltalk code. My
solution was to detect deadlocks and automatically break them with the
idea that any bugs that resulted from this would be exactly the same
bugs you would have in a sequential execution of the same code so it
wouldn't shock the programmer too much.

One thing that the Eiffel system did and I didn't was to lock all of the
message's arguments in addition to the receiver. This, combined with the
passive objects idea, gave their system a more reasonable view of what
an object's state is and how to make it change atomically. What I mean
is that if you send a message to A and it in turn sends a message to B
which changes the state of B you have to consider that the original
message changed (indirectly) the state of A. TinySelf 1's system had too
narrow a view of what an object's state was and didn't handle this.

My current system is like Tweak Islands (if I understood correctly) in
that objects are divided into groups and there is one thread per group.
It is soft of like the Eiffel system but instead of one special active
root object pointing to a bunch of passive subobjects you have all
objects in the group of the same kind. Messages within a group are
synchronous while between objects of different groups use the "futures"
scheme.

-- Jecel



More information about the Squeak-dev mailing list