4 ms·
Creating a shared memory allocation between 2 processes doesn't convert them to threads. The heaps are still distinct.
by kllrnohj 4y ago
Creating a shared memory allocation between 2 processes doesn't convert them to threads. The heaps are still distinct.
- azakai 4y agoThe JavaScript heaps are distinct, that's true, but there is a single shared wasm heap which is used from multiple threads. That is enough to implement the pthreads API. Applications like Photoshop and Google Earth use ptheads on the Web so their compiled C++ is multithreaded, very similar to how it would run natively, and with similar responsiveness and throughput speedups. Though there are some limitations too, see https://emscripten.org/docs/porting/pthreads.html https://emscripten.org/docs/porting/pthreads.html
- flohofwoe 4y agoThe entire WASM heap is a single ArrayBuffer (or SharedArrayBuffer) object.
- koonsolo 4y agoPractically speaking, you just want shared memory in your threads. What would a shared heap offer that shared memory can't?