emacs-devel
[Top][All Lists]
Advanced

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

Re: multi-threaded Emacs


From: Giuseppe Scrivano
Subject: Re: multi-threaded Emacs
Date: Mon, 01 Dec 2008 00:09:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Miles Bader <address@hidden> writes:

> BTW, there was a huge thread maybe a year (?) or so ago about this subject.
> Have you read it?
>
> IIRC, the basic consensus was that some sort of explicitly
> non-preemptive threading was probably the best solution for emacs.
>
> -Miles

I found a thread of 3 years ago (maybe is it this one?  Time passes very
fast :) ) but I didn't find any conclusion.

Anyway, a non-preemptive threading will not give any real parallelism
and it will require more changes in the Elisp packages to use threads as
they will need to say explicitly when give the control to another
thread.
Instead `run-in-thread' will setup the call stack and finally give the
control to the thread.  The only change required in the Elisp packages
to be used in a multithreaded environment is to protect global data
accesses with a lock/unlock, but how many times does it happen to change
the value of a global variable?

Both solutions require changes in Elisp, a non-preemptive threading
needs to explicitly yield the control to another thread, while having
real threads needs to specify when access to global data must be
protected.  The latter one differently allows parallelism and I guess
less changes in the Elisp code too (if writes to global data are less
frequent than specify when exit from the current thread).

Giuseppe




reply via email to

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