edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Adam Thompson <arthompson1990@gmail.com>
To: Karl Dahlke <eklhad@comcast.net>
Cc: edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] One program Two processes
Date: Sat, 26 Dec 2015 09:11:07 +0000	[thread overview]
Message-ID: <20151226091107.GB3144@hob.adamthompson.me.uk> (raw)
In-Reply-To: <20151125185147.eklhad@comcast.net>

[-- Attachment #1: Type: text/plain, Size: 3522 bytes --]

On Fri, Dec 25, 2015 at 06:51:47PM -0500, Karl Dahlke wrote:
> Imagine pieces of js running truly asynchronously of each other
> and of the main interactive edbrowse.
> Such pieces must run under different processes or different threads.
> That's how we leverage the operating system.

Agreed.

> Take processes first.
> This has two problems.
> First is the js pool.
> This is specific to mozilla but that's our engine for now.
> If each edbrowse window, roughly a web page,
> or even finer granularity perhaps, like a js timer,
> if each of these spins up a process to run its js,
> that process has to set its memory pool for the max js
> that that web page might consume.
> 99% of the time this is a waste, most pages having just a little js,
> but oh well, that's what we have to do,
> and after you have pulled up 20 or 30 web pages you are out of memory.
> Maybe duktape wouldn't have this problem but mozilla does.
> You need one pool to take advantage of the law of large numbers.
> Most web pages small, a couple big.
> 
> Now the other problem is that pages can be interrelated.
> The js on one page can vector through window.frames into the js variables in other page.
> No clue how we would do this, since it seems to violate the
> AutoCompartment rules of moz js, but let's say there's a way to get past that,
> then there is an even bigger mountain to climb if these
> exists in sseparate process spaces.

Yes, I can't remember the name right now but one *can* do cross-compartment
requests somehow. I remember seeing the code for this somewhere,
although that may be out of date like a bunch of mozjs docs.

> Remember that windows doesn't have shared memory so we can't just have a common
> js pool for all the processes.
> Sending messages around every time you need an outside variable,
> well maybe, but that's really getting complicated.
> I don't see this as promising.

No, that's going to cause some issues without shared memory etc.

> Next is separate threads in one js executing process.
> This is much more doable, except, again, if you're looking for
> true asynchronicity you have to ask if the js engine is threadsafe?
> Is the compartment and all the variables etc on the stack
> so you can switch from thread to thread and execute the js in each?

Yes, that's one of the reasons behind compartments etc.
In fact they have constructs to support this since I think firefox works with threaded js.

> I honestly don't know, for mozilla or for any of the engines
> we've been considering.
> We'd have to write some stand-alone tests.

Duktape looks small enough it could be made thread safe if we need to.

> Finally, whether threads or processes, we must remember that any http
> request has to vector through one instance of curl,
> one http server that mediates all our needs.
> Processes are impossible here.
> If you want separate http requests to be asynchronous of one another they ahve to be in threads,
> so they can access the same curl space, same cookies, same passwords,
> same agent, etc,
> but then we have the question of whether the curl calls are threadsafe.
> I don't know.
> More tests or research needed.

Yes, again I'm 99 % certain they are.

I'm also going to look into IPC mechanisms for Windows since I believe Chrome
uses multi-process somehow. I know they use a different engine but there must
be some way to communicate this stuff if they're really doing things this way.

Cheers,
Adam.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2015-12-26  9:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-23 15:09 Karl Dahlke
2015-12-23 18:45 ` Adam Thompson
2015-12-23 19:07   ` Karl Dahlke
2015-12-23 19:59   ` Chris Brannon
2015-12-23 20:44     ` Karl Dahlke
2015-12-24 11:19       ` Adam Thompson
2015-12-24 13:15         ` Karl Dahlke
2015-12-24 18:39           ` Adam Thompson
2015-12-25  2:29             ` Karl Dahlke
2015-12-25 23:18               ` Adam Thompson
2015-12-25 23:51                 ` Karl Dahlke
2015-12-26  9:11                   ` Adam Thompson [this message]
2015-12-26 13:36                     ` Karl Dahlke
2015-12-26 15:10                       ` Adam Thompson
2015-12-26 15:23                         ` Karl Dahlke
2015-12-26 15:40                           ` Adam Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151226091107.GB3144@hob.adamthompson.me.uk \
    --to=arthompson1990@gmail.com \
    --cc=edbrowse-dev@lists.the-brannons.com \
    --cc=eklhad@comcast.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).