Mojo child-process instances

39 views
Skip to first unread message

claudi...@gmail.com

unread,
Jun 14, 2016, 5:56:21 AM6/14/16
to mojo-dev
Hi everyone,

I am trying to understand a simple aspect of mojo interfaces: When I have an interface (e.g. //components/filesystem/) and create an instance of this interface, am I able to determine whether object instances must belong to a given process or separate processes?

I just want to know whether mojo currently offers the ability to have a parent-child model for your processes where you may have more than one instance of the same child process.

Regards,

Ken Rockot

unread,
Jun 14, 2016, 10:54:12 AM6/14/16
to claudi...@gmail.com, mojo-dev
On Tue, Jun 14, 2016 at 2:56 AM, <claudi...@gmail.com> wrote:
Hi everyone,

I am trying to understand a simple aspect of mojo interfaces: When I have an interface (e.g. //components/filesystem/) and create an instance of this interface, am I able to determine whether object instances must belong to a given process or separate processes?

Process model is a detail of the embedder, not something individual interface implementations should be concerned with. The filesystem impl needs to be running in a process with sufficient privileges to access the bits of the filesystem it needs, but that detail isn't exposed to the impl itself or to other code which might consume its interface(s).
 

I just want to know whether mojo currently offers the ability to have a parent-child model for your processes where you may have more than one instance of the same child process.

You can use whatever model you like. The EDK provides simple APIs to connect parent and child processes via a primordial message pipe. From there you can pass message pipes and other Mojo handles arbitrarily across the process graph.


Regards,


claudi...@gmail.com

unread,
Jun 14, 2016, 11:05:48 AM6/14/16
to mojo-dev, claudi...@gmail.com
Hi Ken,

Thanks for the reply, however, what if I want to more than one instance of the same process? Am I able to do it?

For instance, Chromium creates separate processes for each tab. I'm trying to understand how would be able to say that for a given mojo app, I actually want more than one processes when I'm accessing it's interface.

Ken Rockot

unread,
Jun 14, 2016, 11:17:34 AM6/14/16
to claudi...@gmail.com, mojo-dev
Again the process model is yours to decide. If you want to host the same interface in multiple apps, or the same app in multiple processes, that's up to you. Mojo APIs serve a lower layer than all of those details so they aren't in any way opinionated about what you should or shouldn't do.

If you plan to use the mojo_runner provided in //services/shell as your host binary, this answer changes. That service does deal with details of the process model, launching processes for app instances, etc. And in that case, yes, it supports launching the same Mojo app in multiple processes. Both user ID and instance ID are used to disambiguate app instances.

However, the behavior of the runner (really the Shell impl there) is not well documented, it's not used in production today, and it should not be considered even remotely stable, so you're sort of on your own if you want to try using it.
 

claudi...@gmail.com

unread,
Jun 14, 2016, 11:34:31 AM6/14/16
to mojo-dev, claudi...@gmail.com
Thanks Ken for prompt and clear answer. I'm aware that //services is currently under constant development. I'm just trying to get some in-depth knowledge and hopefully come up with some experiments in order to better understand how mojo works.

Cheers,

Claudio deSouza
Reply all
Reply to author
Forward
0 new messages