Holding a process by file descriptor instead of PID: Linux pidfds and PID reuse
kill(PID) can signal the wrong process once a PID is recycled. What pidfd_open, polling for exit, pidfd_send_signal and waitid(P_PIDFD) do and do not guarantee, per the man pages.
linuxpidfdprocesssignal