2 ms·
Good write up, just one minor correction: JavaScript has support for multiple threads via Workers. (Also most engines aren't really single-threaded, they just l
by ttfkam 5y ago
Good write up, just one minor correction: JavaScript has support for multiple threads via Workers. (Also most engines aren't really single-threaded, they just look that way. Example: the garbage collector and low-level I/O machinery typically run in separate threads under the VM hood.)
No explicit locking or synchronization is needed for multiple threads either because data can only be owned by one thread at a time, and either the data must be copied during transfer or control of that data must be explicitly released before the next thread takes ownership.
https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage https://developer.mozilla.org/en-US/docs/Web/API/Worker/post...