is child PID always minor to parent PID?

Chuck Swiger cswiger at mac.com
Wed Nov 30 15:31:32 GMT 2005


Javier Matos wrote:
> Hi, I need to know if the PID of a child process is always higher to
> parent PID because I made an algorithm to search a child and I want to
> know if I can start searching for a process that have a higher number
> than parent PID.

No, the PID of a child could be less than the parent if randomize PIDs
sysctl is set, or if the PID counter wraps.

The fork() call returns the child's pid.  Pay attention to that...

-- 
-Chuck


More information about the freebsd-questions mailing list