emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threads in emacs implementation


From: Ted Zlatanov
Subject: Re: Threads in emacs implementation
Date: Mon, 20 Jun 2005 14:04:16 -0400
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.3.50 (gnu/linux)

On Fri, 17 Jun 2005, address@hidden 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]