From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Can we go GTK-only? Date: Tue, 01 Nov 2016 22:42:27 +0200 Message-ID: <83vaw7lyoc.fsf@gnu.org> References: <24db2975-17ca-ad01-20c8-df12071fa89a@dancol.org> <4615E73A-19E2-4B79-9889-D3FA686DDDE6@raeburn.org> <83bmy0pl8p.fsf@gnu.org> <831sywp7ew.fsf@gnu.org> <83y413nsjm.fsf@gnu.org> <83funbnngl.fsf@gnu.org> <83d1ifnmto.fsf@gnu.org> <20161101152027.5e94b6cc@jabberwock.cb.piermont.com> <83ziljm0ei.fsf@gnu.org> <7875855e-b632-491c-c616-4f3662a525af@dancol.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1478032977 31268 195.159.176.226 (1 Nov 2016 20:42:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 1 Nov 2016 20:42:57 +0000 (UTC) Cc: raeburn@raeburn.org, emacs-devel@gnu.org, monnier@iro.umontreal.ca, perry@piermont.com To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 01 21:42:49 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1ft1-0003yq-BR for ged-emacs-devel@m.gmane.org; Tue, 01 Nov 2016 21:42:23 +0100 Original-Received: from localhost ([::1]:51141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1ft4-0002qg-32 for ged-emacs-devel@m.gmane.org; Tue, 01 Nov 2016 16:42:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1fsw-0002qb-Cv for emacs-devel@gnu.org; Tue, 01 Nov 2016 16:42:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1fst-0000Zr-8n for emacs-devel@gnu.org; Tue, 01 Nov 2016 16:42:18 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1fst-0000Zn-51; Tue, 01 Nov 2016 16:42:15 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4403 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1c1fss-0003Jn-0t; Tue, 01 Nov 2016 16:42:14 -0400 In-reply-to: <7875855e-b632-491c-c616-4f3662a525af@dancol.org> (message from Daniel Colascione on Tue, 1 Nov 2016 13:17:01 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:209093 Archived-At: > Cc: raeburn@raeburn.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org > From: Daniel Colascione > Date: Tue, 1 Nov 2016 13:17:01 -0700 > > > 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. No, I didn't. I said something else: that it wasn't safe to assume memory allocations can be freely done in Emacs in non-main threads. > Once you admit that this statement is incorrect I don't have to admit anything, because I never said that. > we can move on to the Emacs-specific discussion, since we cannot > talk about Emacs specifics without understanding the platforms on > which Emacs runs. More to the point, we cannot talk about Emacs without a good understanding of Emacs internals and coding practices. > 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 never said it was infeasible. I said that we are not yet ready for that in Emacs. Granted, given enough development and changes in our practices, and enough experience with native malloc on most platforms, some limited multithreading will be possible in Emacs. Where exactly to put those limits and how much development it will take remains to be seen. Once again, this is about the current situation and the current infrastructure. It is not about some future, nor about the feasibility of this in general. It was my impression that some of the people in this thread thought they can start creating application threads in Emacs tomorrow morning, so I wrote a few words of caution, reminding them that there are currently several obstacles on that road that need to be negotiated first. > 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_. The only platform I know about that starts non-main threads which run Emacs application code is MS-Windows, and there we don't allocate anything off the heap, at least not off the same heap that is used by the main (Lisp) thread. What other threads on which platforms are you talking about? > > 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. Irrelevant example. This is about architecture and design, not about implementation. Intuition, creativity, and gut feelings are always involved in this.