[Top][All Lists]

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

Re: Emacs design and architecture. How about copy-on-write?

From: Eli Zaretskii
Subject: Re: Emacs design and architecture. How about copy-on-write?
Date: Tue, 19 Sep 2023 17:36:57 +0300

> From: Po Lu <luangruo@yahoo.com>
> Cc: Emanuel Berg <incal@dataswamp.org>,  emacs-devel@gnu.org
> Date: Tue, 19 Sep 2023 20:57:30 +0800
> Eli Zaretskii <eliz@gnu.org> writes:
> > If we need to lock 99.99% of Emacs "single" variables, it is easier to
> > lock everything.  Faster, too.
> Interlocking variables is not necessary.  Extant buses guarantee that
> word-sized (Lisp_Object) writes and reads from one CPU are always
> coherently propagated to other processors.  And otherwise, interlocking
> every global variables would incur an extreme performance penalty; two
> extra load-locked / store-conditional pairs (or interlocked
> instructions) for each read or write at the minimum.

That avoids garbled values where part of a value is from one thread,
the other part from another thread.  But it does nothing to protect
the threads other than the one which changed the value from the
"surprise" of having stuff change under its feet.  Which is the main
problem to solve, since Emacs code is written under the assumption
that a variable in the global state doesn't change while some code
runs that doesn't change that variable.  That is why access to at
least some things will have to be serialized -- to allow threads that
access some part of the global state some level of control on what can
and cannot change while they are doing their job.

reply via email to

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