From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Concurrency via isolated process/thread Date: Wed, 05 Jul 2023 14:49:09 +0300 Message-ID: <83bkgqk28a.fsf@gnu.org> References: <871qhnr4ty.fsf@localhost> <83v8ezk3cj.fsf@gnu.org> <87v8ezpov0.fsf@localhost> <83r0pnk2az.fsf@gnu.org> <87pm57pns8.fsf@localhost> <83pm57k01f.fsf@gnu.org> <87v8ey8uv7.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36307"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jul 05 13:50:02 2023 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 1qH11F-0009Dh-97 for ged-emacs-devel@m.gmane-mx.org; Wed, 05 Jul 2023 13:50:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qH10U-0003He-CQ; Wed, 05 Jul 2023 07:49:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qH10S-0003H8-Nl for emacs-devel@gnu.org; Wed, 05 Jul 2023 07:49:13 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qH10S-0006FV-0g; Wed, 05 Jul 2023 07:49:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=925YihkVcOgLp/3Tujr0I0U/KtVGjTppQIo7qcoJI4U=; b=WW6+MI12Emc8 OXcsgkeaLTEbRrZUp2Ff51oEiQamFhc/s29rYNueYG67WWq9W/p7JrtdTW6SxcaLyxIC6i4bl5EpK qIlsBDiiaShazUkvAifo5iHqdrK1S6BJzC7ZMS4zfwZklpv9Nja7N19Fj7MXnse4p+OjEqnGqM+7J mJLzKn3sDlE2qeIlsI5Hjc1GotpBB6P3V+kJHl80c7q9YfOTX1GhfO34VcG74ub857nLBTU56iZO6 La6tTyHdkw1eU6FD6f9kRqZ85/dOWhtGUB6Ch/KIKYQiqvUScWs0CJM7DetYBjJyQS6+Zz29J/WKq O8wXsVHcmGRvxliRaI2uOw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qH10R-00060U-9C; Wed, 05 Jul 2023 07:49:11 -0400 In-Reply-To: <87v8ey8uv7.fsf@localhost> (message from Ihor Radchenko on Wed, 05 Jul 2023 11:23:40 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:307457 Archived-At: > From: Ihor Radchenko > Cc: emacs-devel@gnu.org > Date: Wed, 05 Jul 2023 11:23:40 +0000 > > AFAIU, it is possible to create shared memory only readable by child > processes. > > Then, exchanging data between the two Emacs processes may be done using > memcpy to/from shared memory. > > It may be dumb (I have no experience with processes in C), but I have > something like the following in mind: > > 1. Main Emacs process has a normal Elisp thread that watches for async > Emacs process requests. > 2. Once a request arrives, asking to get/modify main Emacs process data, > the request is fulfilled synchronously and signaled back by writing > to memory accessible by the async process. That solves part of the problem, maybe (assuming we'd want to allow shared memory in Emacs). The other parts -- how to implement async process requests so that they don't suffer from the same problem, and how to reference objects outside of the shared memory -- are still there. > > I have, too many of them. Some are semi-fixed, but I'm afraid we only > > don't hear about them because threads are not used in serious, > > production-quality programs. > > You are talking about bugs? Bugs that are there "by design". > If nobody goes far enough to discover those, > they are probably not the real reason why people do not use Elisp threads. I'm saying that it could be the other way around: we don't hear about those bugs because threads are not used seriously.