Does child process fork() is same as spawn with explicit 'ipc' on Windows ? #5011
|
If the answer is negative what are the differences : is it true that fork() creates new Node.js V8 instance, whereas spawn does not ? In terms of stdio variant I mentioned in the title : Any reference would be appreciated , thanks ! |
Replies: 3 comments 5 replies
|
Check out the |
|
With reference to "Shell scripting with Node.js" by Dr. Axel Rauschmayer , @rauschma , cited :
Now getting back to your last sentence : "They (i.e. threads) are in the same Node.js process" . Both cited above are quite mutually exclusive, don't you thinks so (politely) ? I assume Axel Rauschmayer referred specifically to JavaScript V8-wise workers, whereas your i.e. @cjihrig last statement referred to Libuv-wise threads : if so I see no more contradiction herein as threads DO run within single context (≈isolate?) of Node.js process ? Can you confirm that "Threads Node.js libuv implementation-wise, rather than Workers V8-wise, DO run within single context (≈isolate?) of Node.js process" ? Thank you . |
spawn()is a general purpose function for creating child processes.spawn()can be used to create Node.js child processes.fork()is built on top ofspawn(). It is only used for spawning Node.js child processes.fork()does create an IPC channel.spawn()does not create an IPC channel by default, but can be configured to do so.Check out the
fork()docs.