opensubscriber
   Find in this group all groups
 
Unknown more information…

e : emacs-devel@gnu.org 21 June 2005 • 2:04AM -0400

Re: Threads in emacs implementation
by Ted Zlatanov

REPLY TO AUTHOR
 
REPLY TO GROUP




On Fri, 17 Jun 2005, rms@gnu.... wrote:

>     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
Write).

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).

Ted



_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu....
http://lists.gnu.org/mailman/listinfo/emacs-devel

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.