[squeak-dev] Multiple processes and morphic state (was Re: Changeset: Eliminating global state from Morphic)

Tony Garnock-Jones tonyg at leastfixedpoint.com
Fri Sep 25 14:55:23 UTC 2020


Hi Christoph,

On 9/24/20 2:08 PM, Thiede, Christoph wrote:
>> It's true that in Morphic there is one distinct Process associated
> with the user interface for each Morphic world.
> 
> I'm not so sure about this. You can always do forks within UI code, so
> sometimes there are also multiple Processes within one Morphic world.
> Just think about Shout's background process or debugging processes, and
> please keep in mind that Jakob justifiably proposed to renew the process
> handling for non-modal dialogs, which maybe could also result in
> multiple processes being active at the same time.
> A world can have multiple hands, for example, RemoteHandMorphs
> (Nebraska), event-simulating hands (EventRecorder), or just
> multiple plain HandMorphs as demonstrated by Tony recently in
> his PostmarketOS implementation. There is no reason for these hands to
> run on the same process. Analogously, I don't see why we should restrict
> a hand not to be thread-safe, so the hand-event relation is 1:n again.

I've found that while, yes, there are lots of opportunities for
concurrency in Morphic, actually *taking* those opportunities results in
all sorts of problems.

Morphic state is I think not thread-safe enough to allow multiple
processes "inside" of it at once.

So I've ended up being *very* careful to serialize all Morphic access
within the one, main UI process. Where other processes (Actors) exist, I
send messages from the UI process to the others, and when Morphic state
change code has to run, I package it up into a block and enqueue it for
later execution by the UI process rather than doing it in each Actor.

(It's painful, actually, having to be so careful about it, in such a
C-style "you do all the work yourself and the system won't help you"
manner. Maybe there's something we can improve here?)

So I think it's *morally* true that "there is one distinct Process
associated with the user interface for each Morphic world," even if as a
rule it can be bent a little :-)

Cheers,
  Tony


More information about the Squeak-dev mailing list