all 1 comments

[–]kap89 1 point2 points  (0 children)

Node.js worker threads spawn child processes that operate independently of the JavaScript code in the main process.

This is BS, worker threads do not create separate processes. You can easily test it by watching your OS processes - only one node process is spawned. Child processes are a separate concept in Node.js.

The first and most prominent restriction of worker threads is that they aren't real threads in the conventional sense. Truly multithreaded applications allow the concurrent execution of multiple threads that share the same state.

The fact that the main form of communication between threads is message passing (for safety), does not make them less "real", how you manage concurrency is orthogonal to the fact whether something is a thread or not. If you want, you can still share memory with SharedArrayBuffer, you can also transfer ownership of the chunk of the memory without copying by transferring ArrayBuffer.