System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

PID numbering on HPUX (again)

 
Simon Heffer
Occasional Visitor

PID numbering on HPUX (again)

(Yes there's an old thread on this subject but I need to see whether the info is still valid).
So does HPUX assign the lowest PID available? Or has that changed since 2003?
If I run a script that runs programA several times each run ALWAYS has a higher PID value. Even when I run the script several times.
ps -ef shows plenty of PID space below these PIDs.
3 REPLIES
Matti_Kurkela
Honored Contributor

Re: PID numbering on HPUX (again)

Wikipedia says this about PID assignment on Unix systems in general:
--------------
Under Unix, process IDs are usually allocated on a sequential basis, beginning at 0 and rising to a maximum value which varies from system to system. Once this limit is reached, allocation restarts at zero and again increases. However, for this and subsequent passes any PIDs still assigned to processes are skipped.
--------------
Source:
http://en.wikipedia.org/wiki/Process_identifier

As far as I know, this is pretty much how HP-UX does it, and has "always" done it (at least from version 10.20 onwards).

Once a PID is used by a process, it won't be reused by another process until the PID number allocation wraps around.

A simple "assign lowest available PID" would make it more complicated to detect that a particular process has died, especially in a situation where new processes are started frequently.

MK
MK
Steven Schweda
Honored Contributor

Re: PID numbering on HPUX (again)

If I'm not being too intrusive, why do you
care what any PID is? Why not treat it as an
opaque (integer) value?

Re: PID numbering on HPUX (again)

>Even when I run the script several times.
ps -ef shows plenty of PID space below these PIDs.

Right.

>MK: Once a PID is used by a process, it won't be reused by another process until the PID number allocation wraps around.

That's correct. Though on 11.31 they allow PIDs to be in the billions so I don't know what their wrap point is. There must be some highwater mark they don't exceed if still unused PIDs.