Interpreter scheduler and Child interpreters
Jonathan "Duke" Leto
jonathan at leto.net
Tue Aug 7 15:51:56 UTC 2012
Howdy Bart,
I like the spirit of this branch. I think what you are trying to do
should be possible.
It used to be the case that successively created new interps had to
have the first ever created interp as a parent, but I believe
whiteknight++ removed that restriction recently. Some docs might still
indicate otherwise.
I did something similar to what you are doing in PL/Parrot, but I only
created 2 interps and never had them running at the same time, nor was
I using the scheduler, so I didn't run into these issues.
Also, while adding the the function Parrot_interp_get_scheduler seems
cleaner, we may want to make that a macro if it incurs a large
performance hit.
I hope this helps a bit. Please feel free to barrage us with more questions.
Duke
On Sun, Aug 5, 2012 at 2:27 AM, Bart Wiegmans <bartwiegmans at gmail.com> wrote:
> Hi everybody!
>
> Once again, working on mod_parrot, I noticed a bit of an issue with
> parrot. But I can't really get to how to resolve it, so I'm asking
> your advice.
>
> The context: I want to run multiple interpreters in the same program,
> at the same time, running different programs. This is a requirement
> because otherwise, mod_parrot can only run in the prefork apache mpm,
> which uses a relatively large amount of memory and other resources and
> for this reason is not very popular with web hosters. Thus, without
> running in a multi-threaded enviroment, mod_parrot is nearly useless.
>
> This is not as simple as it seems, because of the following:
> * having two separate interpreters at the same time is apparantly not
> very ok, unless they are parent and child (no idea why)
> * but if a child is instantiated it does not get a scheduler of its
> own (Parrot_cx_init_scheduler)
> * which causes it to crash when starting execution because
> interp->scheduler is 0x0 (literally everywhere in src/scheduler.c)
>
> Thus, I created a new function in src/interp/api.c, called
> Parrot_interp_get_scheduler, and combed through the code to replace
> direct access of the scheduler with this delegated access. However,
> considering the amount of places that it was directly accessed, and
> seeing the behavior of it, I'm actually doubting whether it is a good
> idea. I in fact doubt whether having multiple interpreters is a good
> idea at all given the current state of things. For this reason I'm not
> placing a pull request right now, but I do ask you to review the
> changes in the branch, please see
> https://github.com/bdw/parrot/tree/find-root-scheduler .
>
> Kind regards,
> Bart Wiegmans
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev
--
Jonathan "Duke" Leto <jonathan at leto.net>
Leto Labs LLC http://labs.leto.net
209.691.DUKE http://dukeleto.pl
More information about the parrot-dev
mailing list