emacs-devel
[Top][All Lists]
Advanced

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

Re: Make computational threads leave user interface usable


From: Stefan Monnier
Subject: Re: Make computational threads leave user interface usable
Date: Fri, 03 Nov 2017 11:50:46 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> What if this auto-yield is made optional?

The problem is that the megabytes of C and Lisp code out there all
assume that there's only a single thread running.  This assumption is so
strong that we don't even really provide the synchronization primitives
necessary to make real concurrent programming usable (e.g. locks,
transactions, ...).

So such an option would be similar to a "please corrupt my Emacs state
in random ways" option.

As you've seen context switches are currently very expensive (they
undo all the dynamic-bindings of the source thread and reinstall the 
dynamic-bindings of the destination thread).

It's probably a good idea to start thinking about how to add real
concurrency to Emacs, but it needs to start by looking at how we can
make sure the concurrent threads only share read-only data (plus some
extra shared state properly protected via some transactional system, or
maybe just no shared state but some messaging mechanism instead).

That requires a serious design effort on the Elisp side, with a good
understanding of the current C code, plus some deep changes at the
C level.


        Stefan




reply via email to

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