Re:Show HN: Life – A secure, blazing-fast, cross-platform We...
by AgentME on Thursday August 02, 2018 @05:17PM
(#17675560)
It looks like this Life VM has a "RunWithGasLimit" function that can run WebAssembly for a limited number of steps. I'm not sure if it pauses or aborts the VM when the limit is reached.
On a related note: you can enforce a CPU limit on WebAssembly in any engine by using wasm-metering[0]. Note that if the WebAssembly hits the limit, it is entirely aborted, not paused. So wasm-metering is good for limiting the CPU usage of a WebAssembly binary that has short functions called regularly, but not capable of time-slicing a long-running WebAssembly function. I think you'll need custom support from a WebAssembly VM (or a much more extensive preprocessor) for that.
On a related note: you can enforce a CPU limit on WebAssembly in any engine by using wasm-metering[0]. Note that if the WebAssembly hits the limit, it is entirely aborted, not paused. So wasm-metering is good for limiting the CPU usage of a WebAssembly binary that has short functions called regularly, but not capable of time-slicing a long-running WebAssembly function. I think you'll need custom support from a WebAssembly VM (or a much more extensive preprocessor) for that.
[0] https://github.com/ewasm/wasm-metering