What is the lowest possible process ID that a Linux process can have?
On my system the lowest ID running right now is 1 (init
). I'm making a small wrapper function around pidof
and I was wondering, what is the lowest possible process ID a process can have?
The reason I ask is because I would like to return an integer from my function indicating "process was not running" (pidof itself returns an empty string in this case). I wa开发者_JAVA百科s thinking of using either 0 or -1, and I just want to make sure a real process could never have such IDs.
PIDs are always positive, so both 0 and -1 are OK as non-PID sentinels. Several PID-related system calls, like wait()
and kill()
, assign special meaning to these values.
精彩评论