-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cross-machine calls in vm #803
Comments
Hi! IMO, the dependency on the windowing system should be stubbed out somehow in It may be better to narrow the interface somewhat and have the worker depend on that restricted API just for the things it needs. Not sure how much extra stuff is in |
On Sun, Mar 29, 2020, 10:47 AM Michael FIG ***@***.***> wrote:
Hi! IMO, the dependency on the windowing system should be stubbed out
somehow in xs-cli-lin.
Yes, I plan to do something like that.
|
how to
|
Hi @dckc good question. With separate vats being separate xs machines, with separate resource budgets, and only asynchronously coupled, it's clear that these are uopts --- units of preemptive termination. With them being arbitrarily synchronously coupled, this would be much tricker or impossible. A single call stack could thread through an arbitrary number of these, and it's not clear what to do when one of them terminates. What we actually have is an odd mix, a solvable special case between these two: Each vat is directly coupled only to the swingset kernel. Via the swingset kernel, each vat is only asynchronously coupled to every other vat. The synchronous coupling between the swingset kernel and any one vat is extremely limited and designed to support crash, revival, and deterministic replay. But we've got a layering problem. We don't want the xs engine to know about or make any special case for swingset. |
@dckc - XS workers have no dependency on a window system at all. The PC implementation of them is built to run in "screen test" host simulator, so you see the word screen. If you look at the microcontroller implementation of workers in modWorker.c, you will see it is quite minimal. |
@dckc - There's nothing about |
Sure I know I can implement fxAbort as I choose. But the only argument is
the xsMachine*. How do I find the worker data structure to terminate it?
And how do I terminate the worker deep down in the stack without violating
invariants in the worker code?
…On Sat, Apr 4, 2020, 6:43 PM Peter Hoddie ***@***.***> wrote:
@dckc <https://github.com/dckc> - There's nothing about fxAbort that
requires it to take down all machines. fxAbort is a host function
precisely so a host can define the behavior it wants in that case. Our
usual implementation calls exit because that's simple and safe for a
micrcontroller. But you can do whatever you need there.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#803 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABE3SQ5WSCY6P36K6W6RMTRK7A23ANCNFSM4LVZVQYA>
.
|
The mixed stack is an issue. @warner does it make sense to start with the async-only-coupled vats, to get the separate termination working there, before worrying about accommodating swingSet's very limited synchrony? |
That's up to you. The invocation of
|
Thanks to @michaelfig , I'm over a hump. We can terminate mallet independent of alice and bob. cd49457e https://github.com/dckc/moddable/tree/xmachine/examples/js/xvat (git hash is not stable; IOU better commit message and I expect to force-push when I do) |
Cool! How did you get that working? |
In lin_xs_cli.c, void worker_abort(xsMachine *the, txWorker *worker)
{
// NOTE: the = the worker machine, not the owner as in _terminate
GMainLoop* main_loop = worker->main_loop;
GMainContext* main_context = g_main_loop_get_context (main_loop);
fprintf(stderr, "@@!!!abort worker=%p main_loop=%p main_context=%p\n",
worker, main_loop, main_context);
fxWorkerTerminate(worker);
// TODO: notify owner
g_main_loop_unref(main_loop);
g_main_context_pop_thread_default(main_context);
g_main_context_unref(main_context);
fprintf(stderr, "about to kill thread...\n");
g_thread_exit(NULL);
fprintf(stderr, "already killed this thread; this should not print!\n");
} |
Makes sense. |
If so, the analogy to worker becomes even stronger: |
We don't need this for the plan in #2107 ; it may be nice to have eventually, but if we have some way of signalling that issues are postponed to a later release, this is a good candidate. |
This is overtaked by events such as adding the vat warehouse #2277. |
A goal arising from discussion with @dtribble @erights @warner @michaelfig and co is to use some xs mechanism that lets each vat run in its own unit of resource allocation and let them be terminated independently. Meanwhile, the kernel has to be able to call them (synchronously), (and vice versa?).
I started working on a special host object that contained a new xsMachine. It was going OK, but then I wondered if I'm reinventing Workers poorly and yup, it sure looks like it.
One snag with just using Workers out of the box is that they're currently tied to a windowing system for debugging and such. When I try to build the worker example on our xs-cli-lin platform, I get:
This is perhaps a duplicate of #516; feel free to close this if you'd rather I took my notes there. Or perhaps I should raise a Workers tied to windowing screen issue against the moddable SDK?
https://github.com/dckc/moddable/tree/xmachine a57a6e9
The text was updated successfully, but these errors were encountered: