Subject: bug#38807: [Feature request]: Support lisp workers like web workers.

From: HaiJun Zhang <[email-masked]>
Date: Tue, 31 Dec 2019 08:40:06 +0800

在 2019年12月31日 +0800 AM3:19，Eli Zaretskii <[email-masked]>，写道：
> > From: Michael Albinus <[email-masked]>
> > Cc: HaiJun Zhang <[email-masked]>, [email-masked]
> > Date: Mon, 30 Dec 2019 19:31:26 +0100
> >
> > The point seems to be that there is a dedicated UI thread. That we don't
> > have (yet) in Emacs, and I like this idea.
>
> We do have that on MS-Windows. Except that you'll be surprised how
> much of "UI" in Emacs cannot be done in a separate thread, mainly
> because the Lisp machine is under such complete control of what the UI
> does, and you cannot run several instances of the Lisp machine
> simultaneously and asynchronously.

What about the following idea:
1. Make the current lisp machine be customized which has two profiles:
    + full featured: as the current running lisp machine in emacs
    + subset one: without all UI functions
2. Run the full featured one as emacs does now. It acts as the master lisp machine(for UI only), which behave like the UI thread(process) in the web browser.
3. Run some subset ones for workers. Workers are started by the master lisp machine. Workers can send messages to the master machine by calling some APIs. The messages are copied to the master lisp machine, so GCs don’t need to work across machines.
4. Provide some APIs for them to communicate with each other.