emacs-devel
[Top][All Lists]
Advanced

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

Re: Can we go GTK-only?


From: Daniel Colascione
Subject: Re: Can we go GTK-only?
Date: Tue, 1 Nov 2016 13:17:01 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 11/01/2016 01:05 PM, Eli Zaretskii wrote:
Date: Tue, 1 Nov 2016 15:20:27 -0400
From: "Perry E. Metzger" <address@hidden>
Cc: Daniel Colascione <address@hidden>, address@hidden,
 address@hidden, address@hidden

On Tue, 01 Nov 2016 19:15:31 +0200 Eli Zaretskii <address@hidden> wrote:
Extraordinary claims require extraordinary evidence. Your claim
is extraordinary: it's been common practice for _decades_ to make
memory allocations from multiple threads in multithreaded
programming.

This is simply incorrect.  On _some_ platforms, that is true.  But
not on all, not anywhere near that.

You've explicitly refused to name an exception, and no one else is
aware of one, so how can we give credence to your claim?

Again, were your claim truly correct, no multithreaded C or C++
software would be stable on such a platform, so it seems like a very
unlikely statement. This is the sort of bug that would be found in the
first week that threading package shipped. The relevant standards have
also required it as long as threads have existed. I am disinclined to
believe it is true without evidence, and you refuse to present
evidence.

I was not talking about multithreading in general.  I was talking
specifically about Emacs, its coding practices, and its particular
design and needs wrt memory allocation.

You categorically stated that memory allocation off the main thread is unsafe. Once you admit that this statement is incorrect, we can move on to the Emacs-specific discussion, since we cannot talk about Emacs specifics without understanding the platforms on which Emacs runs.

The distinction is important: Lisp allocation is unsafe because of the layers we put on top of the system heap, not because the system heap is itself unusable. For example, we can create a scheme where we have multiple Lisp universes, each with its own heap and GC, and each bound to a single thread. (Like Web Workers.) If system malloc were unsafe, this scheme would not be thread-safe, But since system malloc _is_ thread safe, this Emacs-specific approach to multithreading becomes feasible.


I named several factors that
together lead me to the conclusion that we are not yet ready to allow
arbitrary multithreading in Emacs, although we and the supported
platforms are moving in the right direction.  The problems and issues
with thread-safe malloc in C libraries is just one of these factors,
perhaps not even the most important one, since at least in Emacs 25
many platforms we support don't use their native malloc.  (We switched
most of them to native malloc in Emacs 26, but we don't yet know
whether the results will be good enough, although we hope so.)

If you want to make this discussion a constructive one, please argue
about these aspects: about Emacs and Emacs alone, and how it can or
cannot tolerate arbitrary memory allocations, both for C and Lisp
objects, in multiple threads.

Emacs today can tolerate arbitrary memory allocations off the main thread after dumping using the system heap. I know this to be case because Emacs today, on the most common platforms --- OS X, GNU/Linux, and Windows, all perform allocations off the main thread in very common configurations _already_.

IOW, the arguments in such a
constructive discussion should be about specific aspects of Emacs
design and implementation, and about Emacs programming, that are
related to memory management.

As for "claims": this is more about gut feelings, based on the factors
I mentioned, than about anything else.  It is OK to disagree with gut
feelings, even if you agree with the facts.  It is NOT okay to make
this a discussion about my credibility.  If my credibility is being
questioned, I will simply step down.

When prototype aircraft were designed according to gut feelings about how aerodynamics worked, they were unable to take off under their own power. When the Wright brothers designed their aircraft using data from a wind tunnel, their aircraft flew.




reply via email to

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