Raymond Toy <[EMAIL PROTECTED]> writes:

> I believe thread switching is slow because it has to copy the control
> (?)  stack on each switch.

Maybe you mean the "binding stack", which holds bindings of special
variables?

> The obvious solution is adjusting the stack pointer to point to the
> new control stack, with no copying.  Do not know if this would work
> or not.

Well, I guess one would have to frob SYMBOL-VALUE to make this work.
One could store symbol values for each thread in thread-local storage,
and let SYMBOL-VALUE retrieve it from there.

On x86, I think its common to use one of the segment registers FS or
GS to implement per-thread data.  A thread switch changes the value of
the segment register, and instructions with a segment prefix can be
used to access thread-local data.

I hope that's approximately right; it must have been >10 years since I
last used that :).

Reply via email to