Save and restore the system state #12942
Unanswered
ingoahrns
asked this question in
Core Development
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
this is my first time that I'm contacting this group, I hope I'm following your guidelines.
I'm trying to setup a S/W that shall manage several different "instances" of micropython which shall run in a round-robin manner. For this purpose I need to switch between the different instances and I tried to save the state of an instance before switching to another instance which then has to be restored before some scripts are evaluated in the new context.
However, I recognized that switching states is not so easy if possible at all. I'm only targeting at a simplified case:
It is working as long as I do not perform a garbage collection. That means the switching works perfectly and I can switch between different instances and their context but if it comes to garbage collection. The program crashes.
Here is what I tried to do:
The source code shows the C functions I applied to save and restore the python state. 'SaveState(int context)' shall save the state to some variables storing the heap, the stack and the context variable. 'RestoreState(int context)' shall restore the state of a given context.
Does anyone tried something similar and could find a way to solve this? Is it possible at all or am I missing an important point? Any help would be very much appreciated.
Thanks very much in advance.
Ingo
Beta Was this translation helpful? Give feedback.
All reactions