NodeJS Snippet: Child Process

Offload tasks to a spawned process to unblock the main thread

Udara Bibile
Level Up Coding
Published in
7 min readJan 23, 2020

--

Node.js is single-threaded by design, thereby requiring it to keep the main Node process unblocked to continue execution. Moreover, Node is limited to one thread and 1.76GB (for 64-bit OS) memory usage. Thus, external processes are required to offload CPU intensive processing in parallel. The child_process module in Node allows us to spawn processes that can be used for any task to be run in parallel.

Builtin Node.js module: child_process

--

--