Home/Glossary/Process manager

Process manager

System software designed to automatically start, monitor, and restart background processes and services.

A process manager is a specialized tool used to control the lifecycle of background applications and services. Its primary function is to ensure high availability by automatically restarting processes that crash or exit unexpectedly. Unlike manual execution, a process manager detaches the application from the user session, allowing it to run as a daemon.

Operational Logic

The manager monitors the process via its PID (Process Identifier). If the process terminates with a non-zero exit code, the manager triggers a restart based on a predefined backoff strategy. Key capabilities include:

  • Aggregating stdout and stderr logs for centralized debugging;
  • Enforcing resource limits for CPU and memory usage;
  • Managing environment variables without modifying source code;
  • Enabling cluster mode to utilize multiple CPU cores.

In Linux production environments, systemd is the standard for managing system-level services. For Node.js development, pm2 is preferred due to its built-in monitoring and zero-downtime reload features. supervisord is frequently used in Python environments or within Docker containers to manage multiple sub-processes simultaneously.

For instance, running pm2 start app.js --exp-backoff-restart-delay 100 ensures that if an application fails, the time between restart attempts increases incrementally, preventing log flooding and excessive CPU load during persistent failures.