Skip to content

wasi: provide thread-safe implementations of WASI contexts #5235

@abrown

Description

@abrown

With the presence of shared memories and, eventually, with wasi-threads providing a way to spawn multiple Wasm threads, access to the WASI state will no longer be single-threaded. This state (e.g., WasiCtx for wasi-common) must be appropriately protected from concurrent access, e.g., by locking as @haraldh has attempted here.

What complicates this issue is that I expect that not all users of Wasmtime will want to pay the performance penalty for locking access to WASI. This means that we may need two implementations for each WASI state object, ideally factored so that all the meaningful bits are kept in one place. Also, there may be some complications when wiring up either the single-threaded or thread-safe implementations of each WASI context during linking; presumably the thread-safe version should be used when the threads feature is enabled, but it is unclear if all of the Host types will be agreeable with this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wasm-proposal:threadsIssues related to the WebAssembly threads proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions