[Top][All Lists]

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

Re: Are there plans for a multi-threaded Emacs?

From: Ted Zlatanov
Subject: Re: Are there plans for a multi-threaded Emacs?
Date: Thu, 04 Dec 2003 08:05:15 -0500
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (usg-unix-v)

On Thu, 04 Dec 2003, address@hidden wrote:

> What about simply having a single mutex for everything? It's
> essentially always held, and a thread only relinquishes it to do
> blocking operations. Immediately afterwards it reacquires the lock.

> I take it this would essentially be the same as your starting point,
> where all functions are synchronous - nothing runs at the same time
> as anything else. There are however only small benefits to go
> further:
> o  To be able to run several threads simultaneously in multicpu or
>    hyperthreaded systems.
> o  To get OS level preemption between threads.

Those two benefits make a big difference.  Today's Pentiums have
hyper-threading technology, so even a single processor can act as
two.  The best cooperative multitasking can't make use of multiple
processors as well as premptive multithreading.  Cooperative
multitasking definitely has benefits - time-critical applications for
instance, but I don't think that applies to Emacs.

> I see these benefits with this model compared to a "fully"
> multithreaded variant:
> o Fairly small changes in the C code.  

> o No significant change in the elisp execution model, at least not
> if preemption is avoided.  

> o Little overhead in locking - there's no fine grained locking on
> individual data structures.

I agree with all those.  Converting a single-threaded application to
multithreaded, especially one as complex as Emacs, is a daunting
task.  I think it's worthwhile.


reply via email to

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