-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Allow Subprocesses from Filesystem : ESP32? : #4480
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
Comments
In the meantime I've begun poking around trying to make this happen - mostly doing a lot of reading about cPython and some digging around in MicroPython source. One thing I noticed of interest is this comment from py/mpstate.h:
So it looks like at one point there were other people interested in this improvement. |
There are 3 main ways to do things concurrently in MicroPython:
1 and 2 already exist and work well, and are characterised by the fact that all Python code has access to the same heap (so can share objects). But 3 is probably what you are after here: the ability to instantiate separate VM contexts to run completely isolated Python code. In such a case you'd need a separate heap for each instance, so the separately executing code could only share data via OS primitives. This would be pretty much equivalent to subprocesses in CPython.
Yes, this is how it would be done, to provide a separate |
@dpgeorge A big thanks for sharing your time with me. You're right, option #3 is my aim. May have jumped the gun on naming this issue after the subprocess module - upon re-inspection it seems to handle general command line arguments to the OS which is more functionality than I need. I'm encouraged to hear that you've used multiple A rough outline of my upcoming strategy is this:
I feel very comfortable with steps 1 and 3-5, particularly if there is input from other people as to what they'd like to see from such a module. The part that worries me is still trying to be sure that I don't have any scope conflicts with other state variables - any advice about this would certainly be appreciated. Soon I will make a fork for this purpose and post the link here so that curious, helpful, or any other kind of person can see what's happening. |
I've created a fork of micropython to work on localizing the interpreter. The goal is to ultimately create a standardized method of creating new interpreters to run alongside existing interpreters. Check out the fork to see what's happening, contribute to the discussion, and try it out on your own hardware.
|
I'm attempting to do a similar process soon, and I'd like to see whatever code you have, to better understand how you solved the problem. Is there a link I may see for it? |
@Joseph-93 sure thing, here it is. Got it working at a basic level with a simple module to control individual processes, though I have since abandoned the effort. |
…e_length Use GCC @file to shorten linker command length
Hello everyone.
My goal is to be able to dynamically select Python files from the filesystem and run them 'concurrently' - also choosing when to stop one and begin another. In an ideal world you could provide the equivalent to a 'yield()' call in those python files that would allow others to execute, but running them end to start could work as well. I am raising this issue to a) seek advice from those who are more familiar with the complexities here and b) see if anyone is interested in such an ability / would like to collaborate to make it happen.
I have considered a few possible ways to make this happen, but I don't know which fits best in the ideology of MicroPython or which is the easiest to implement.
(My sights are focused on the ESP32 port but if this could be a MicroPython wide addition then I'm game)
I'd really appreciate advice / thoughts on this topic. If it can be a worthy addition to MicroPython then I'll be eager to help out! If it's not right then I'd still appreciate advice on how to proceed for my own extension that I can offer.
I guess that about wraps it up for now. Looking forward to talking about this. Thanks!
The text was updated successfully, but these errors were encountered: