Interpreter scheduler and Child interpreters

Bart Wiegmans bartwiegmans at gmail.com
Sun Aug 5 09:27:12 UTC 2012


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


More information about the parrot-dev mailing list