Introduce flag to prevent reallocation of shared memory
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- wasm
- Área
- operating-systems
Línea de trabajo
El issue no menciona archivos del repositorio, pruebas ni puntos de entrada de la implementación; empieza revisando la propuesta de WebAssembly threads y los ejemplos de instanciación de shared memory del informe. Determina si una caché de memoria o un flag asociado al módulo están dentro del alcance, define su ciclo de vida y su semántica de encapsulación, y documenta los criterios de compatibilidad y validación antes de la implementación.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Instantiating a module more than once allocates new memory for each instance, what if, instead, there could be a flag that would cause all instances to refer to the same memory?
Instead of them being thread-local memories, they would be "global."
This allows Wasm to remain completely self-contained, encapsulated, and in control of its own memory.
Currently, shared memory is completely useless if not importing host shared memory, but every step in between the module getting its memory, and the host passing it to the module, leaves room for mutation, and unexpected change at runtime, as the host has control over the array buffer too.
Nothing more would need to be changed, it would just change the lifetime of the memory.
This could be implemented as a simple cache associated with the module.
Current loading (JS):
// main.mjs:
const memory = new WebAssembly.Memory({ ..., shared: true });
const {
instance,
module
} = await WebAssembly.instantiateStreaming(..., ...memory...);
const thread = new Worker("./worker.mjs", ...);
worker.postMessage({ memory, module });
// worker.mjs:
... // await .postMessage({ memory, module })
const instance = await WebAssembly.instantiate(module, ...memory...);
With cached memory:
// main.mjs:
const {
instance,
module
} = await WebAssembly.instantiateStreaming(...);
const thread = new Worker("./worker.mjs", ...);
worker.postMessage(module);
// worker.mjs:
... // await .postMessage(memory)
const instance = await WebAssembly.instantiate(module);
In the former example, the WebAssembly module's memory may be corrupted later at the will of the host, breaking encapsulation, but the way that multi-threaded Wasm loading works, it leaves no alternative.
Would this break any of the core motivations/ideas/philosophies behind WebAssembly?
- Lenguaje dominante
- WebAssembly
- Estrellas
- 769
- Forks
- 54
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de WebAssembly/threads
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
WebAssembly/threads#254 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
WebAssembly/threads#253 · 6 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
WebAssembly/threads#245 · 1 reacción ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
WebAssembly/threads#240 ·
-
Branch renamingAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 20/100
WebAssembly/threads#237 ·
Todos los issues de WebAssembly/threads
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
MiSTer-devel/ao486_MiSTer#243 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
siderolabs/pkgs#1710 ·
Los mantenedores suelen responder en 1 día
-
good first issue kernel
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
JackFurton/who-would-build-a-kernel-in-java#81 ·
Los mantenedores suelen responder en 1 día
-
[BUG] Windows: per-process values that can't be read (handles, I/O, network) still show as 0, not N/APosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoagent:Windows bug MEDIUM windows
Dificultad 2/5 Medio día Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día