- run a Worker instance in its own
fork
- load application, execute global configuration (e.g.
TCPServer.new
) - when monitor has loaded: send SIGVTALRM to monitor process
- forks N worker processes
- on SIGCHLD: 1. collect zombie worker processes 2. fork worker processes to replenish pool
- on SIGTERM: 1. send SIGTERM to worker processes (exit gracefully) 2. don't replenish pool anymore 3. send SIGINT to worker processes (exit now) after timeout 4. exit
- on SIGINT (first time): 1. behave as SIGTERM
TODO:
- on SIGINT (second time): 1. send SIGINT to worker processes (exit now) 2. exit
- on SIGTTIN: 1. print monitor status 1. print workers' status
- forks/execs monitor process
- on SIGUSR1: 1. forks/execs a new monitor process (which then forks new worker processes)
- on SIGVTALRM: 1. tells old monitor process to gracefully terminate (SIGTERM) 2. tells old monitor process to exit after timeout (SIGINT)
- on SIGTERM: 1. send SIGTERM to monitor process (exit gracefully) 2. exit
- on SIGINT (first time): 1. behave as SIGTERM
- on SIGINT (second time): 1. send SIGINT to monitor process (exit now) 2. exit
TODO:
- on SIGTTIN: 1. print main process status 2. send SIGTTIN to monitor process
Running state:
- panzer:main
- panzer:monitor
- panzer:worker (1)
- panzer:worker (2)
- panzer:worker (3)
- panzer:worker (4)
- panzer:monitor
Restarting state:
- panzer:main
- panzer:monitor (exiting)
- panzer:worker (2, exiting)
- panzer:worker (4, exiting)
- panzer:monitor (new)
- panzer:worker (1)
- panzer:worker (2)
- panzer:worker (3)
- panzer:worker (4)
- panzer:monitor (exiting)