3 ms·
This is probably hand-waving but : instead of implementing threads directly into the WebAssembly language, would it make sense to compile a known micro-kernel t
by grondilu 9y ago
This is probably hand-waving but : instead of implementing threads directly into the WebAssembly language, would it make sense to compile a known micro-kernel to WebAssembly and then compile the C standard library (which, IIRC, implements threads)?
- AnIdiotOnTheNet 9y agoYes. Let's combine the renowned safety of the C standard library with the speed and efficiency of a web browser!
- Rusky 9y agoThis wouldn't help at all. Kernels (micro or no) can only implement preemption with the help of hardware timers (and, if you want parallelism, hardware cores), which Webassembly cannot access. (The C library does not implement threads; it merely wraps the kernel's implementation of them.) So at some level WebAssembly itself must provide some sort of primitive for threading, or else at best you'll get cooperative coroutines/an event loop.
- deleted 9y ago[deleted]
- gwbas1c 9y agoI'd rather see something like async/await before true threads. So much of web programming is network IO bound; that what we really need are primitives that make async programming easier. Threads can come later. The problem is that when async programming is hard due to language or framework difficulties, threads are the easier choice. But then, older code is locked into patterns that are hard to refactor to async/await.