Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Nov 2005 10:31:32 -0500
From:      Chuck Swiger <cswiger@mac.com>
To:        Javier Matos <javierlu@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: is child PID always minor to parent PID?
Message-ID:  <438DC5D4.80700@mac.com>
In-Reply-To: <001601c5f5c2$a77a0720$0301a8c0@mindcrash>
References:  <001601c5f5c2$a77a0720$0301a8c0@mindcrash>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?438DC5D4.80700>