allocation of process ids in UNIX?

allocation of process ids in UNIX?

Post by Andrew Sherm » Fri, 09 Jul 1993 01:09:43



I'm looking into how often UNIX process ids (PIDs) are reused.

According to Leffler et al., "BSD maintains a range of unallocated PIDs
between [two values] mpid and pidchecked."

So on BSD, quickly allocated PIDs tend to increase by 1 for a time,
then jump up a bit and increase by 1 again.  Eventually (around 29999
it seems - maybe a configurable value?) they wrap around and start
increasing again. This system seems to be used in SVR4 as well.

What this means is that to get a process id reused you have to have a
busy machine.

Now, guess what? AIX has its own algorithm. It seems that PIDs on AIX
often increase by 255. Sometimes successive PIDs decrease in value for
a while. You never seem to get two consecutive integers as PIDs.

So I'm interested in any insight into how (and why) PIDs are allocated
in AIX, or other UN*Xes.

Thanks

-Andrew

--


Ingres, an ASK company, 1080 Marina Village Parkway, Alameda, California 94501
We're supposed to be XXXXing professionals (Mr. Pink)

 
 
 

allocation of process ids in UNIX?

Post by Uwe Geud » Fri, 09 Jul 1993 17:08:31


Andrew> Now, guess what? AIX has its own algorithm. It seems that PIDs on AIX
Andrew> often increase by 255. Sometimes successive PIDs decrease in value for
Andrew> a while. You never seem to get two consecutive integers as PIDs.

Andrew> So I'm interested in any insight into how (and why) PIDs are allocated
Andrew> in AIX, or other UN*Xes.

This question pops up now and then. Most popular speculations are that
the Pentagon, the CIA or however didn't want consecutive pids because
that would be a security problem.

The truth, however, can be found in #include <sys/proc.h>. Internally
the pid consists of two parts: the slot in the process table and a
consecutivly assigned usage number within that slot. This makes access
to the process table a straight indexing operation, so efficiency
seems to be the real reason doing it different than others.
--


 
 
 

1. Finding out User Id given Process id

Hopefully someone out there can help me. I need to find out the User Id of
a process, given it's pid. I need some generic system call, which will work
across a range of UNIX systems. I know I could use ps and grep the results,
but I want to do this from C without using ps.

Any help appreciated (even if telling me it's not possible)

Roy Harrington

2. PPP with Solaris and OS/2?

3. Matching thread ids to process ids

4. Problem installing 5.0

5. Finding out User Id given Process id

6. change tab size

7. Process id to user id

8. Wireless Recomendation

9. How Often do Unix process ids get recycled ?

10. HELP !!! UNIX PROCESS ID !!!!

11. unix command: killing process id with ps

12. VFS 3 mapping window's user-ids to unix-ids

13. Syncronizing user id on the PC with UNIX logon id