> I'm thinking of ways to avoid the stack penalties the other proposals
> involve. Could we allow only secondary threads with thread-local
> variables and forked copies of globals?
> "Forked copies of globals" would mean copies of the values of
> thousands of Lisp symbols. And how would the Lisp interpreter know
> whether and where to look for them? It does not seem practical.
Don't make copies of the globals then, unless they are modified.
If the secondary thread modifies a global, make the copy then (Copy On
If the primary thread modifies a global, trigger a copy for every
thread of the OLD value (null op if no threads exist).
The interpreter would just have to keep a hashtable of hashtables;
primary key is the secondary thread ID and the secondary key is the
global symbol. When a thread modifies a global, look in the HoH; if
the symbol is not in there you create an entry. To get a symbol value
in a thread, you do two hashtable lookups; in the primary thread
there's no lookups.
There should be a way that a thread can send data back to the main
thread on request (the main thread asks for the data).