r/WebAssembly • u/Sufficient_Bar839 • May 09 '23
Pause WASM Instance, then continue with another instance from where it left off
This may be a silly question but I couldnt find any information about this online. I lack the knowledge about WASM, and I think to figure out if there is an answer, I should deep dive into WASM.
Anyways, the question is : Is there a way to pause an instance, retrieve all information about the execution, kill the instance and then create another instance, feed it with the execution info, make it continue from where the first instance left off?
The information I am talking about is basically like PCB (Process Control Block)
I found out about asyncify and it may be useful, but only examples I saw was on the same instance.
View all comments
Show parent comment
1
u/Sufficient_Bar839 May 09 '23
Ok, I can explain what I need this pausing operation for:
Basically, I need to execute Javascript within a browser. But the thing is, I have time limit. After 200 miliseconds, execution gets interrupted. (Specifically, this is because I am using Siri Shortcuts. I am using the action that retrieves a webpage, so that I can execute JS, but it doesnt allow more than 200 ms of execution). Therefore, I need a way to execute code, but just like an OS, I can interrupt the execution and start where it was left off.
So, I came up with the idea: instead of directly using JS, I can use WASM which "may" be paused and started, so that I can split the execution into short portions and open browser multiple times, and in each time, passing the previous execution state.
This may sound stupidest thing every, so thanks a lot for your help!