In a server-side application, multiple processes can be running simultaneously, each of which has its own memory space and runtime environment. Process management refers to the ways in which these processes are created, managed, and terminated.
exec.
fork.
spawn.
How would you spawn a child process in Node.js to run a shell command, and how would you capture its output?
If a child process you started exits with a non‑zero code, what steps would you take in your Node.js code to handle it?
What happens if you forget to call child.unref() on a detached process?
You added a new feature that uses child_process.exec to run a script, but the application sometimes hangs. How would you debug the issue?
When using the cluster module to take advantage of multiple CPU cores, what trade‑offs do you consider regarding state sharing and graceful shutdown?
Why might using exec instead of spawn cause memory problems in a high‑traffic Node service?
Design a process management strategy for a Node.js microservice that must stay up 99.99% and handle traffic spikes, considering clustering, monitoring, and zero‑downtime restarts.
How would you implement graceful shutdown of a Node.js server that has multiple worker processes handling in‑flight requests?
Explain how you would decide between using the built‑in cluster module versus an external manager like PM2 in a large‑scale deployment.
At an organization level, how would you standardize process management across many Node.js services to ensure consistent observability, restart policies, and resource limits?
Describe the architectural implications of moving from a monolithic Node.js app using cluster to a container‑orchestrated system (e.g., Kubernetes) that manages processes for you.
What long‑term maintenance challenges arise from relying on custom process‑management code, and how would you mitigate them across teams?