mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bert hubert <ahu@ds9a.nl>
To: Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: random PID generation
Date: Fri, 23 Feb 2001 15:18:08 +0100	[thread overview]
Message-ID: <20010223151808.A22022@home.ds9a.nl> (raw)
In-Reply-To: <27525795B28BD311B28D00500481B7601F0EF4@ftrs1.intranet.ftr.nl>
In-Reply-To: <27525795B28BD311B28D00500481B7601F0EF4@ftrs1.intranet.ftr.nl>; from f.v.heusden@ftr.nl on Fri, Feb 23, 2001 at 02:20:27PM +0100

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.

Regards,

bert hubert

-- 
http://www.PowerDNS.com      Versatile DNS Services  
Trilab                       The Technology People   
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet

  reply	other threads:[~2001-02-23 13:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-23 13:20 Heusden, Folkert van
2001-02-23 14:18 ` bert hubert [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-02-27 10:35 Heusden, Folkert van
2001-02-23 15:34 Heusden, Folkert van
2001-02-23 15:40 ` Matt Johnston
2001-02-23 17:14   ` Sean Hunter
2001-02-23 17:50     ` Richard B. Johnson
2001-02-22 15:35 Heusden, Folkert van
2001-02-22 22:24 ` bert hubert
2001-02-22 21:42   ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010223151808.A22022@home.ds9a.nl \
    --to=ahu@ds9a.nl \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®