From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: Re: Concurrency via isolated process/thread Date: Wed, 05 Jul 2023 11:23:40 +0000 Message-ID: <87v8ey8uv7.fsf@localhost> References: <871qhnr4ty.fsf@localhost> <83v8ezk3cj.fsf@gnu.org> <87v8ezpov0.fsf@localhost> <83r0pnk2az.fsf@gnu.org> <87pm57pns8.fsf@localhost> <83pm57k01f.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31818"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jul 05 13:24:52 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 1qH0cu-00081u-2t for ged-emacs-devel@m.gmane-mx.org; Wed, 05 Jul 2023 13:24:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qH0bu-0008LQ-DO; Wed, 05 Jul 2023 07:23:50 -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 1qH0bs-0008Kv-J5 for emacs-devel@gnu.org; Wed, 05 Jul 2023 07:23:48 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qH0bq-0006Xc-Cw for emacs-devel@gnu.org; Wed, 05 Jul 2023 07:23:48 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id C3C69240029 for ; Wed, 5 Jul 2023 13:23:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1688556223; bh=mp4nRzDwGJ2dLSfsHZCb9wWaOI0Q4p5HLmCX3yn1uHg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=ecb16Ayd7MU2WG2MplL/PNZXDAm7HErynv/W930TwpgZR4clSgTIsDAp8yQNklIXz M6ll73tXdUvynymxywpd0gDDT2V6sPEiJhel2NpbGkMh/Y+/R1YtdJ7YRKo62h45NN pWmcjFRbtF6gu8W+zSrZRZwyfq4qP5nB2e4CzSsQlXOb40z4URsc0USvwQFNmFVMNQ 0M6oiFBR8Emekqix9KzmsQ6Qa9G56CmBgPZ2hIECbZOI5W/W/mlhJ/v61uCxHKfGaV Ct6q6SKBYYE+ONI1+iN9udqEwtrpYifro5Z+MUYymTu/5arw4ivsLwoTApKrJR5V+u d6/3MBPhalb2A== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Qwy330h6Gz9rxN; Wed, 5 Jul 2023 13:23:42 +0200 (CEST) In-Reply-To: <83pm57k01f.fsf@gnu.org> Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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:307454 Archived-At: Eli Zaretskii writes: >> > I don't think you can design on this base. Security and all that. >> >> But why is it a problem? > > I'm not an expert, but AFAIK reading from, and writing to, the memory > of another process is something allowed basically only for debuggers. > > And how would you know the address in another process anyway, given > today's ASLR techniques? I am looking at https://stackoverflow.com/questions/5656530/how-to-use-shared-memory-with-linux-in-c 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. >> > Also, complex structures include pointers and references, which you >> > cannot safely copy as-is anyway. >> >> May you please elaborate? > > For example, a list whose member is a string includes a pointer to > that string's data. I imagine that instead of trying to copy Lisp objects recursively, there will need to be a special "remote" Lisp object type. Getting/setting its value will involve talking to other Emacs process. >> > I wish this were the only problem with threads. >> >> Maybe. But I haven't seen other problems preventing threads from being used. > > 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? If nobody goes far enough to discover those, they are probably not the real reason why people do not use Elisp threads. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at