Process local variable and debugging

Lex Spoon lex at cc.gatech.edu
Mon Feb 11 18:38:24 UTC 2002


"Andreas Raab" <Andreas.Raab at gmx.de> wrote:
> If you have as simple a model as Squeak has there is an even easier (and
> more efficient) way of doing TLS. All you need is some slot in Process
> which will hold an array of "Global Association -> current value". When
> you switch between processes you exchange the globals with the current
> value of the association, e.g., when you switch _from_ a process you
> restore the old and remember the private values whereas if you switch
> _to_ a process you restore the private and remember the global values.
> Trivial to implement.
> 
> The advantage of this scheme is that the cost of using TLS is associated
> exclusively with the process actually using them. If you switch between
> processes not using TLS you don't do anything at all - if you switch
> to/from a process making heavy use of it, you pay the price just as you
> have to.
> 

That's exactly how I implemented them with my Islands project in Squeak.
 I also made most global variables into thread-specific variables,
meaning the price got paid quite a lot.  :(  -Lex



More information about the Squeak-dev mailing list