moonheart08 commented on Issue #860:
I personally probably have one of the sillier use-cases for the ability to pause/resume (I wanted to put WASM computers in Minecraft as an exercise), but it gives a few very important use cases for Wasmtime some light:
1) The traditional browser use-case of having separate isolated Wasmtime VMs up and going at once
2) The embedded into another application use-case in, say, a game, where the VM hanging the place would be disastrous, and you're under a strict schedule to get each frame out on time (and as such need a watchdog system, where each VM gets a per-frame budget of how much it gets to execute before pausing)
fitzgen commented on Issue #860:
Note that pausing is harder than stopping because you have to save the execution state (stack and all that) so that you can pick it back up again later. We want this eventually since wasm will eventually get stack switching, but we can probably support interrupting and stopping long-running wasm modules sooner.
In addition to the translate loop header stuff, what we would need is a timer thread or something that sets a flag once a module has taken too long, and then the loop header (and function prologues!) would check that flag and do a custom interrupt trap if it is set.
sunfishcode closed Issue #860:
Once a
wasmtime::Instance
in created thestart
function will be run. This may lead to the current thread being blocked for a long time. It would be helpful to have the ability to stop or pause anwasmtime::Instance
while it is running.
Last updated: Nov 22 2024 at 16:03 UTC