From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: Questions about throw-on-input Date: Fri, 15 May 2020 10:19:35 +0200 Message-ID: References: <8920fe6a-8fe4-addd-c29e-2213850bf974@web.de> <83k11f7v4q.fsf@gnu.org> <4506133a-5e63-4ae7-9b5d-830359e8b673@default> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="6344"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Richard Stallman , emacs-devel@gnu.org, p.stephani2@gmail.com, yyoncho@gmail.com, alexanderm@web.de, eliz@gnu.org, Drew Adams To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 15 10:20:21 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZVZr-0001WO-KL for ged-emacs-devel@m.gmane-mx.org; Fri, 15 May 2020 10:20:19 +0200 Original-Received: from localhost ([::1]:48150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZVZq-0006sk-EI for ged-emacs-devel@m.gmane-mx.org; Fri, 15 May 2020 04:20:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZVZH-0005J1-7V for emacs-devel@gnu.org; Fri, 15 May 2020 04:19:43 -0400 Original-Received: from mail-am7eur06olkn2033.outbound.protection.outlook.com ([40.92.16.33]:14440 helo=EUR06-AM7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZVZE-0006Nw-PO; Fri, 15 May 2020 04:19:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZbfQcRWzRVDy4EkS3vVm4IRtLRF4VwBDa5zfdlqx5faLzq5K9mIrYDp47dyNjIsfWM5oMznjKQuOYNVB+Nt/bhUNUf3U/fBU79e3Cb6J5ASxrVdLKh4dFo1y/TpTPjacz282u6Bm1qNMI6v4rJ2Pt7Qsz0qXFPj943Tv+wpaEaHqT6fgrdb40r3SirfcffoEGE5Laqzxv3zEw7AAwRAaWxHfh6XIQ56suKVqMyoh/sbyDOmOlPGjtCZ4dBR5b89nPa3P2r25W8rWf161ebiuErJ7CfAAhOSBgsxgJNK1kBK1gzsSP/jAiV48e69oF/Gc7U1BTSYEYO6GQpOWO/2E4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HqVfIwHx/EsgC0un1Po7ADws+cwyejuD7urQwPTA4bs=; b=SsiNg6WeT60ztPOKQL/MGRfonZQu3i4XCvnoCNczV9xthqJft7YaU/A9EyUfMQSP1u8AIAle01yEsCs2SDWKxPkF13iU5doDxo+eQjwMi8NJuaZZ+Uts9Ww7/yHZHrO8B2DAmfgkCRdOfB+0NUWkdJRBpk9Vprjq+HKglCBAg1IR/GTGo2iBomNwVsUWtYmLDpy31Y+4wNWGFrv2jCYpxDpyivzZfb2ivUZc9j1X0R0LT0ubBlI6tzgafanWpigpOhGEpY/6lH6eAvVwyDwjNoIw9QcadBCXy/VWHcEmlyJ/duPqJctYc6Vy/N8wZONERataIjEdVk7uASU9FCw4ug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.com; dmarc=pass action=none header.from=live.com; dkim=pass header.d=live.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HqVfIwHx/EsgC0un1Po7ADws+cwyejuD7urQwPTA4bs=; b=Em2nysmPMXIqhA9c4KmnrCr4ZLJR31ll9ENdg7WV4Ws96v4B5YQ4cuOy02JTl8rCMEe7RoouD2wqckwOPqJhWFQbOePA3fULBhvvnjqIe7r5E+bZukZZKTagjrJnzztsj+gcIfTIf4HYaxNyG4h0JQ8ZUqHOiZPsKcWEJeLJvMl2DMh7T3jCbxvENAqw41VuLJHGqksYJCan9IAwjAiAMZP86MTLsV7+isC8nVet3zVHPgWBP7hrrJRsUta+fb7gb/ZgwbUdrXGEuh89RIfc2spXd/TMjk0wV485qh5F72irR5BX0+oly3nXqS4m55vQyNn80kGi+xOojZPnlQhJ1A== Original-Received: from AM7EUR06FT040.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc36::45) by AM7EUR06HT163.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc36::243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19; Fri, 15 May 2020 08:19:37 +0000 Original-Received: from VI1PR06MB4526.eurprd06.prod.outlook.com (2a01:111:e400:fc36::42) by AM7EUR06FT040.mail.protection.outlook.com (2a01:111:e400:fc36::497) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 08:19:37 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:426C9D540D54B4D5ACDD0A7DAEC1D48E8102B7EBCB0FFAF26D82E5EDDF55F97B; UpperCasedChecksum:37AD8133FD52C269BF4D5F48E1ED13A3D6F33EA126D563DF5A3A23DF3EE27992; SizeAsReceived:7902; Count:48 Original-Received: from VI1PR06MB4526.eurprd06.prod.outlook.com ([fe80::49f0:2314:a959:bec5]) by VI1PR06MB4526.eurprd06.prod.outlook.com ([fe80::49f0:2314:a959:bec5%7]) with mapi id 15.20.2979.033; Fri, 15 May 2020 08:19:37 +0000 In-Reply-To: (Stefan Monnier's message of "Thu, 14 May 2020 23:54:09 -0400") X-ClientProxiedBy: AM5PR0602CA0003.eurprd06.prod.outlook.com (2603:10a6:203:a3::13) To VI1PR06MB4526.eurprd06.prod.outlook.com (2603:10a6:803:ac::17) X-Microsoft-Original-Message-ID: <87tv0h4nl4.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (90.230.29.56) by AM5PR0602CA0003.eurprd06.prod.outlook.com (2603:10a6:203:a3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 08:19:36 +0000 X-Microsoft-Original-Message-ID: <87tv0h4nl4.fsf@live.com> X-TMN: [LrFDldta1uxig6iNQB98JrYKK6xW/kG6] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 3f1af08c-6dd7-4d21-cbe4-08d7f8a8b4ec X-MS-TrafficTypeDiagnostic: AM7EUR06HT163: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eI3x3Y8EIu2vtkvFQPfdJzAiN4izSWXwWkpF5HxNhJdNl/jw+a63pXZWPwKiqQwNFhIS+wu2X9Cwain0yjG0xNA49aSBVzRO9DEQpIBnFGyrNhOjiJpRtolzsCO6v0CKvVO+AMuc5L2/oRfpGj1Qcs6A2apaLHTQ6xVxyzAAO30TGcqXyY/FyHHeogObpnApPXDQeiZUpyCHwzF+tflFLw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:0; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR06MB4526.eurprd06.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:; DIR:OUT; SFP:1901; X-MS-Exchange-AntiSpam-MessageData: SU1HWFDuyir+9MUwZmN+aNlV+CS0dzADhqmDCRup3PFGXnOeEDaC0GcpqPeNFW8d72vU91aM6gmrM0BIrO2gl+fTEFYl32ITLavqkYCdc4ScOiwGQVgecycDcN/p93GwNGK9z24E3vtFtHglD7wT6w== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f1af08c-6dd7-4d21-cbe4-08d7f8a8b4ec X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:19:37.5862 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7EUR06HT163 Received-SPF: pass client-ip=40.92.16.33; envelope-from=arthur.miller@live.com; helo=EUR06-AM7-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/15 04:19:38 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:250363 Archived-At: Stefan Monnier writes: >> An editor buffer is global mutable state. Global mutable state is at >> the heart of GNU Emacs, and I disagree with the idea that we should >> try to get away from it. That is a non-goal. > > But the goal talked about here is concurrency. Concurrency is not > incompatible with global state, but it's incompatible with global state > accessed from anywhere without any way to control it. > > The problem, as I see it, is that we could imagine binding threads to > buffers such that a buffer can only be accessed by a single thread at > a time. > > That would be reasonably easy to implement, I think, by putting a lock > on buffer objects (since there are fairly few ways to access a buffer: > you almost always have to make it current first). But the buffer's > local variables can contain data such as hash-tables or cons-cells which > can be shared between various buffers, and that is a lot harder to > control because we don't want to put a lock on every cons cell. > > Maybe we could have a notion of "buffer-local data/heap" and "global > read-only data/heap" or something like that and some way make sure that > a thread only operates of buffer-local data and global read-only data, > in which case it can indeed safely run concurrently with other Elisp > code operating in other buffers. > > > Stefan I have a question, most for curiosity, it is is ok :-): If you reversed the thought and started at "thread-end", could you make every buffer be owned by some thread. Instead of buffer-first, would it help to think thread-first? Thus Emacs process would become more of a thread-scheduller, similar as some web browsers are using separate process to render each webpage (in its own tab); I think Firfox uses threads instead of processes. Maybe not the best way to use multiprocessor cpus as of today, but certainly better then nothing at all. Dont' know if it possible for Emacs and how underlaying "lisp machine" is constructed. Maybe each thread could have it's own eval. But then how would they communicate when they need, since Emacs buffers often are used together in some way unlike webpages in a browser. I hope you dont't mind interfering and my curiosity.