Subject: Re: new pid allocation code
To: Bill Studenmund <wrstuden@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 03/12/2003 00:40:05
> What is the layout of how you use bits in a PID?

It dynamically changes.  The bottom bits index the table and high bits
are the sequence count (zapped to zero when they get to PID_MAX).
When the table size has to be increased, the boundary point is moved.
So if PID_MAX is 32767 you might start with 32 slots each with 1024
pid values, as soon as you have (about) 30 active processes the table
grows to 64 slots each of which has 512 pid values.

Additionally, PID_MAX will be increased inorder to ensure that
pid numbers are not reused for at least (IIRC) 2000 forks.
(this requires that NO_PID be -1 or similar)

The allocation rules tend to give much more unpredictable values.
My system currently has pids:
  0    1    2    3    4    5    6    7    8    9   10   11 
105  170  178  184  207  217  227  231  253  274  275  282 
289  308  311  334  341  343  344  365  367  380  382  414 
435  447  468  475  500  501  506  525  566  593  625  627 
654  710  711  861  949 1749 1909 3301 3360 3361 4383 6327
7398


	David

-- 
David Laight: david@l8s.co.uk