child_process.fork()
The node:child_process function that starts another Node.js process running a given script, with a built-in message channel to it.
In more detail
Parent and child exchange JavaScript values with send() and the message event. Each child is a full process with its own V8 heap, so it costs more memory than a worker thread.
Related terms
- child process — A process started by another process, its parent, from which it inherits a copy of the environment and current directory.
- inter-process communication — The ways separate running programs pass data to each other, such as pipes, sockets, shared memory and signals.
- worker threads — The Node.js module for running JavaScript in parallel threads inside one process, each with its own V8 isolate and event loop.
Taught in
- Child Processes: spawn, execFile, fork & IPC — Node.js Internals & Backend Services
- Worker Threads: worker_threads & SharedArrayBuffer — Node.js Internals & Backend Services
- Cluster Architecture: node:cluster & Zero-Downtime — Node.js Internals & Backend Services