[Top][All Lists]

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

Re: Concurrency via isolated process/thread

From: Ihor Radchenko
Subject: Re: Concurrency via isolated process/thread
Date: Wed, 05 Jul 2023 11:23:40 +0000

Eli Zaretskii <eliz@gnu.org> 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

AFAIU, it is possible to create shared memory only readable by child

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 <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

reply via email to

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