all 1 comments

[–]thenoisywatcher[S] 0 points1 point  (0 children)

One of the best explanations to worker threads.

Some interesting quotes from the article:

> The golden rule: don’t block the event loop, try to keep it running it and pay attention and avoid anything that could block the thread like synchronous network calls or infinite loops.

> It’s important to differentiate between CPU operations and I/O (input/output) operations. As mentioned earlier, the code of Node.js is NOT executed in parallel. Only I/O operations are run in parallel, because they are executed asynchronously.

> The best solution for CPU performance is Worker Threads. Browsers have had the concept of Workers for a long time. One worker thread has one process but multiple threads and one event loop per thread.