wait() on a PID that is not your child
wait() on a PID that is not your child
Posted Oct 9, 2011 7:25 UTC (Sun) by ebiederm (subscriber, #35028)In reply to: wait() on a PID that is not your child by neilbrown
Parent article: A Plumber's Wish List for Linux
/proc/$PID/ is linked to the process and it very much becomes empty when a process dies.
If a new process gets the same pid a different directory is created.
The tricky bit is actually is the way process death updates are implemented internally. The data structures are backwards and need to be turnedd around so poll on the file descriptor could be implemented.
There is still the race of changing into the directory at the top of this thread but pid reuse is typically slow enough that race should be hard to hit.
