3 ms·
As you point out, using the pid alone is not reliable. FWIW, Solaris and illumos systems have process contracts that allow you to reliably track processes[0].
by dap 12y ago
As you point out, using the pid alone is not reliable. FWIW, Solaris and illumos systems have process contracts that allow you to reliably track processes[0]. If the child forks, it's the new child is still in the same contract (unless configured otherwise). And both the child or parent (the watcher) can restart and then return to the normal state (parent watching child processes).
Solving this problem requires kernel support because the kernel is generally the only fault domain in the system that cannot crash while the system is still running.
Edit: forgot the link the first time.
[0] http://illumos.org/man/4/process http://illumos.org/man/4/process
- feld 12y agoLinux has this capability in recent kernel versions (3.x?). I don't know what the implementation is called (prctl?), but DragonflyBSD add this in procctl(2) in release 4.0. FreeBSD already had a procctl(2) and added the same functionality to be compatible. http://lists.dragonflybsd.org/pipermail/commits/2014-November/343844.html http://lists.dragonflybsd.org/pipermail/commits/2014-Novembe... So now FreeBSD and DragonflyBSD have plans to utilize this exactly like Illumos and build lightweight process supervision without the need for something as disruptive as systemd.