Why in https://github.com/WebAssembly/wasi-libc/blob/1dfe5c302d1c5ab621f7abf04620fae92700fd22/libc-bottom-half/sources/__wasilibc_real.c#L664 does thread-spawn come from a "wasi" module and not "wasi_snapshot_preview1" like everything else in this file?
Hello!
I saw that they have thread spawn in wasi_preview1 in wasmer: https://github.com/wasmerio/wasmer/blob/36b077d34b47ec735e5bac7aebcf2878e30135e7/lib/wasi/src/lib.rs#LL398C11-L398C11
So if you are able to generate a wasm file with the thread-spawn in the preview namespace then we should be able to run it in the example I send over
Ok, but it is the Wasi-SDK that is placing thread-spawn in wasi. I could just change it and rebuild the sdk I suppose, submit a PR and see what they say
https://github.com/WebAssembly/wasi-libc/pull/418
thread-spawn
comes from https://github.com/WebAssembly/wasi-threads which I believe is part of preview2, not preview1.
wasi-threads is currently being developed within the framework of preview1, because it's built on the instance-per-thread model, which isn't compatible with preview2.
There are people working on designs for a native threading mechanism for core wasm, which would have various advantages, including being compatible with preview2 and the component model, but it's in an early stage right now.
Dan Gohman said:
There are people working on designs for a native threading mechanism for core wasm, which would have various advantages, including being compatible with preview2 and the component model, but it's in an early stage right now.
Is there any public information on this? Like a proposal?
The basic design is described in the "Weakening WebAssembly" paper: https://dl.acm.org/doi/pdf/10.1145/3360559
The paper also covers lots of memory ordering topics, but the relevant part here is the fork
instruction for creating new threads, and the shared
qualifier for functions, globals, etc.
(I'm hoping that fork
gets renamed because it's not like Unix fork
; it doesn't clone the current callstack, it just starts a new thread executing a given function)
I don't know of any public updates on this yet, but I have heard that there are people starting to work on moving this forward.
I knew about the paper, was wondering about public updates indeed. My impression was that the idea is totally abandoned.
I'm glad it's being picked up again!
Will close as apparently "wasi" is the right import, so maybe it is wasmer that is wrong. I'm pretty confused to be honest.
Scott Waye has marked this topic as resolved.
Scott Waye said:
Will close as apparently "wasi" is the right import, so maybe it is wasmer that is wrong. I'm pretty confused to be honest.
for some reasons wasmer exports it with multiple names.
Last updated: Dec 23 2024 at 12:05 UTC