Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do node.js forked processes share any memory via copy-on-write?

In (some?) Unix systems when you fork a process the new process will share memory with its predecessor. The memory will be shared as long as it's unchaged. This is called cow, copy-on-write.

I wonder if Node.js process forking has any technical benefits from cow. If it does then what do Node.js processes share exactly?

like image 575
Gherman Avatar asked Sep 07 '25 09:09

Gherman


1 Answers

No.

As the documentation says:

Unlike the fork(2) POSIX system call, child_process.fork() does not clone the current process.

like image 120
Vladimir Panteleev Avatar answered Sep 08 '25 22:09

Vladimir Panteleev