[lkml]   [2001]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: random PID generation
On Fri, Feb 23, 2001 at 02:20:27PM +0100, Heusden, Folkert van wrote:

> > With truly random PIDs, there is a much larger chance of a new process
> > sitting on a recently used PID.
> My code runs trough the whole task_list to see if a chosen pid is already
> in use or not.

But it doesn't check for a recently used PID. Lets say your system is
exhausting 1000 PIDs/second, and that there is a window of 20ms between you
determining which PID to send to, and the recipient process receiving it.

With truely random PIDs, there is now a chance of 1-(1-1/32000)^20 that a
new process will have the PID of the process you intended your signal for.
That's 0.06%, but historically, we care for those kind of chances.

The complete formula is: 1-(1-1/32000)^(dt*pps), where dt stands for the
time interval and pps for the number of pids created per second.

Currently, there are problems if your dt*pps product is bigger than 32000,
which in practice won't ever happen.


bert hubert

-- Versatile DNS Services
Trilab The Technology People
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:17    [W:1.989 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site