Skip to content
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

Thread pool of pre-loaded VMs #2

Open
nitely opened this issue Apr 18, 2016 · 7 comments
Open

Thread pool of pre-loaded VMs #2

nitely opened this issue Apr 18, 2016 · 7 comments
Labels

Comments

@nitely
Copy link
Owner

nitely commented Apr 18, 2016

Would allow to run JS code in parallel. Should support asyncio. Should be transparent (ie: same API as for managing one VM)

@nitely nitely added the feature label Apr 18, 2016
@thedrow
Copy link
Contributor

thedrow commented Jul 23, 2016

Doesn't V8 have it's own GIL? What would happen if you initialize multiple VMs inside a process?

@nitely
Copy link
Owner Author

nitely commented Jul 23, 2016

It's explained in the docs. You can run multiple VMs, each has its own GIL.

@thedrow
Copy link
Contributor

thedrow commented Jul 24, 2016

Oh that's really cool. I didn't know that it was possible. If you try to do the same with Python you're going to encounter some nasty issues.

@nitely
Copy link
Owner Author

nitely commented Jul 24, 2016

Yes, the alternative (in Python) is to spawn a child process. V8's devs could have done the same to work around the GIL, but instead they added the concept of isolate (a VM for all practical purposes) to achieve the same with threads (I dunno why they wanted threads so badly, since with isolates you still share nothing). I think that feature is there to support web workers.

@thedrow
Copy link
Contributor

thedrow commented Jul 24, 2016

I thought that it's not possible since in MRI Ruby you are not allowed to use more than one V8 VM in one process.

@nitely
Copy link
Owner Author

nitely commented Jul 24, 2016

I guess it must be a limitation of the gem (therubyracer?), maybe it's built on top of an older V8.

@thedrow
Copy link
Contributor

thedrow commented Jul 24, 2016

Actually ExecJS disallows it and both therubyracer and miniracer don't support it. Kudos on having that already built in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants