WebAssembly / WebAssembly/threads

What are the plans for thread-local and shared global variables?

Open
#4 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
767
Forks
54
PR merge metrics
No merged PRs in 30d

Description

AFAICT for the current web embedding of WebAssembly, globals are effectively thread-local: you have to create a new instance of a module for each JavaScript worker, so any mutable globals will also be duplicated for each worker. Is that correct?

I assume that's not as efficient as allowing instances to be shared between workers, and adding some form of thread-local variables.

Do we need shared global variables? Shared vs thread-local is only meaningful for mutable variables, and mutable shared globals can be lowered to an immutable global address into shared memory, so it might be simpler to just omit shared globals.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue contains no file, test, or entry point to inspect, and asks unresolved design questions about thread-local and shared global variables. First establish the intended WebAssembly threading model and an agreed scope; no concrete done condition is stated beyond resolving those questions.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.