Problem Statement
What is a fork in Node.js?
Explanation
The `fork()` method in the child_process module creates a new Node.js process that runs a separate script. It’s useful for scaling CPU-bound tasks or running isolated background jobs.
Code Solution
SolutionRead Only
const { fork } = require('child_process');
const worker = fork('worker.js');
worker.on('message', msg => console.log('Message:', msg));