loading...

re: Everything you need to know about Node.js VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Thanks for commenting. Node.js by default works in a single CPU core, so worker thread will spawn and execute in the same CPU core that the main t...
 

Well, if a separate worker and main thread are executed in one CPU core, then they share the same resource.
Is it correct that if we write heavy CPU code in "chunks", i.e. we will return execution context from a heavy function to the function which handles http requests with some interval, then we will emulate workers? But in this case it's not necessary for Node to allocate resources for a subthread, i.e. it's cheaper in terms of performance.

Remember Worker as OS thread actually so I don't think they will be emulated in a single CPU core case. Anyway that's an interesting question but unfortunately workers are pretty "new" so there isn't enough information about them.

Code of Conduct Report abuse