1824218 Members
3926 Online
109669 Solutions
New Discussion юеВ

PID numbering on HPUX

 
SOLVED
Go to solution
Tim Killinger
Regular Advisor

PID numbering on HPUX

As the system admin hosting a new app on our 11.0 rp5450 using iPlanet webserver and oracle, I've noticed that the app occasinally monopolizes the CPUs with DB connections and the PIDs of these processes increased from 4500 to 9000 in the course of a few minutes.

I suspect that DB connections are created and terminated at a very rapid pace during these few minutes and am trying to help the application group identify what is going on during these 5 to 10 minutes bursts.

I have two questions at this point.

1 - Does UX begin with PID #1 and boot time and increment up as each process is created, and if so, what is the highest number a PID can have before it begins at #1 again?

2 - What tools might you suggest that a relatively novice admin might use to identify what these process might be doing during their very short life span?

I realize there is not much to go on here, but I'm trying to learn how to isolate and explain what might be going on here...

Thanks!!
7 REPLIES 7
doug mielke
Respected Contributor

Re: PID numbering on HPUX

Unix doesn't reuse a pid until a process copmpletes, and opens up a slot in the process table. Unix does pick the lowest available pid from the proc table, so if you are up to 9000, that should mean that there are 9000 procs in the table, running, defunct / zombie, etc. waiting to be cleaned up.
Max number of pids is a kernel param, maxproc.

doug mielke
Respected Contributor

Re: PID numbering on HPUX

correction:
maxuproc number of processes allowed for a specific user.

NPROC total number of entries in the process table.
doug mielke
Respected Contributor

Re: PID numbering on HPUX

...and, to monitor the process table you could try

while :
do
ps -elf >> /tmp/outfile
sleep 1
date
done

This will list all processes each second (sleep interval)
Don't run too long, disk space will be consumed rapidly.
Dietmar Konermann
Honored Contributor

Re: PID numbering on HPUX

Tim,

from glossary(9):

--- snip
process ID

Each active process in the system is uniquely identified during its lifetime by a positive integer less than or equal to PID_MAX called a process ID. A process ID cannot be reused by the system until after the process lifetime ends. In addition, if there exists a process group whose process group ID is equal to that process ID, the process ID cannot be reused by the system until the process group lifetime ends. A process that is not a system process shall not have a process ID of 1.
--- snap

If I recall correctly, PID_MAX is 30000.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
A. Clay Stephenson
Acclaimed Contributor

Re: PID numbering on HPUX

First of all, process id 1 is very special. It belongs to the 'init' process and is never re-used. Depending upon the flavor of UNIX, PID's typically increase upto 30,000 (sometimes 64K) and then rollover BUT skipping past any PID's currently in use.

You could script ps -ef commands and append the output to a file or you could use Glance to watch processes. You might find that many of these transient processes share a few common parent PID's (PPID's) and thus the parent is what you want to focus upon.
If it ain't broke, I can fix that.
Jeff Schussele
Honored Contributor

Re: PID numbering on HPUX

Hi Tim,

Actaully PIDs start at 0 & this PID's purpose is to spawn the init process - PID 1 - which will then spawn all the PIDs that spawn PIDs that spawn PIDs, etc.
PID 0 does not live past boot so you never see it. PID 1 however lives forever & like a good grandparent will adopt any child PID abandoned or orphaned by it's parent.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Bill Hassell
Honored Contributor
Solution

Re: PID numbering on HPUX

As mentioned, the PIDs are incremented by 1 for each new process up to 30000 and then new process ID numbers wrap around. But it is certainly possible to have 10,000 processes all start up and run for a few milliseconds. So in answer to question #2, all you can do is to run ps -flu userID (I assume that you know which user is running these processes) over and over in a script. If the pathnames are long (such as Java code), add the -x option to ps (you must be up to date on patches). About all you can tell is what the process names were, the parent process, the size of the process. Whether the process was performing I/O on a particular file, doing LAN polling, changing values in shared memory, there is no way to tell from the outside.


Bill Hassell, sysadmin