Hi folks, my friend and I are working on supporting preemptive threading in Wasmtime (i.e., adding the scheduling part to time-slice running fibers and perform runtime-managed context switches, right now, round-robin only). This work is built directly on top of the existing cooperative threading context-switching work last month. Our current prototype is x86_64-only, since the runtime currently has full support only on x86_64.
We have an initial implementation exploring two interrupt mechanisms:
This has been a fun project, but we would like to sanity-check the direction with the Wasmtime team and the broader community:
This work is primarily exploratory and for fun, but we are also hoping to align on whether a proposal is plausible and, if so, to have a concrete target to guide further implementation.
Thanks!
Sounds like a great project!
Jerry Yang said:
- Is there any existing plan to have a proposal or design around preemptive threading?
Not that I'm aware of -- at least not for the component model.
- If not, would it be preferable for us to draft something and share it for discussion, and if so, should that discussion start on Zulip or GitHub?
A PR to the component-model would probably be a good place for a draft if you've got something concrete to share. If you're still feeling out the design space, an issue on that repo and/or a discussion on Zulip would also be appropriate.
The main question that comes to mind for me is: How might this be implemented in other runtimes which might not have an equivalent to epoch interruption or fuel metering?
Last updated: Jan 10 2026 at 20:04 UTC