From: Bodo Eggert <harvested.in.lkml@7eggert.dyndns.org>
To: Jesper Juhl <jesper.juhl@gmail.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Jan Engelhardt <jengelh@linux01.gwdg.de>,
"linux-os (Dick Johnson)" <linux-os@analogic.com>,
Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: pid_t range question
Date: Fri, 10 Feb 2006 02:19:33 +0100 [thread overview]
Message-ID: <E1F7Mwg-0001SK-3p@be1.lrz> (raw)
In-Reply-To: <5Eqr8-3To-13@gated-at.bofh.it>
Jesper Juhl <jesper.juhl@gmail.com> wrote:
> I can think of at least 3 ways to at least hide that cosmetic problem
[of /bin/ps]
> a bit. Won't solve the problem but will make it less likely that most
> people will ever encounter it.
>
> (assuming below that we want something like 64bit pids but want to
> keep pids at 5 digits as much as possible)
[...]
> 2. Allocate pid's as we currently do, but once we hit 99999 wrap the
> pids and start allocating from free pids starting from 2 and up. only
> if no pids below 99999 are free do we continue upwards and allocate
> pid 100000.
2b) don't try that hard, and hopefully speed things up:
<pseudocode>
for (max = 3814; /* max == 999817216 * 8 */; max = max * 8) {
// the above values result from int(1000000000/8^6){,*8^6}
newpid = random(max)+1;
if allocate_pid(newpid)
goto got_the_pid;
// repeat the above in order to make it less likely
// to get a high PID? I hope it's not nescensary.
if (max == 999817216) // otherwise an uint32 will overflow
break;
}
// possible here to increase the chance for a low pid but also for
// long runs while searching for the first free pid:
// newpid = random(99999)+1;
pid_search_stop = newpid;
while (++newpid != pid_search_stop) {
if allocate_pid(newpid)
goto got_the_pid;
}
got_the_pid:
</pseudocode>
TOSOLVE:
Find a cheap random function.
What to do on 4294967295 allocated processes?
Eternal starvation if nearly 4294967295 are present and the right ones
get stopped/started?
How to get CPU power to run 4294967295 processes?
--
Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF
verbreiteten Lügen zu sabotieren.
next parent reply other threads:[~2006-02-10 1:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5DDTr-6Lw-43@gated-at.bofh.it>
[not found] ` <5DJlY-6J8-29@gated-at.bofh.it>
[not found] ` <5EnCK-7Qt-9@gated-at.bofh.it>
[not found] ` <5Eoz4-PV-21@gated-at.bofh.it>
[not found] ` <5Eqr8-3To-13@gated-at.bofh.it>
2006-02-10 1:19 ` Bodo Eggert [this message]
2006-02-07 16:23 linux-os (Dick Johnson)
2006-02-07 22:16 ` Eric W. Biederman
2006-02-08 0:19 ` Ulrich Drepper
2006-02-08 2:39 ` Eric W. Biederman
2006-02-09 16:58 ` Jan Engelhardt
2006-02-09 18:11 ` Eric W. Biederman
2006-02-09 20:13 ` Jesper Juhl
2006-02-10 13:21 ` Jan Engelhardt
2006-02-15 20:40 ` David Lang
2006-02-15 21:00 ` Eric W. Biederman
2006-02-17 16:38 ` Jan Engelhardt
2006-02-17 21:20 ` David Lang
2006-02-17 21:39 ` Eric W. Biederman
2006-02-21 11:22 ` Herbert Poetzl
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=E1F7Mwg-0001SK-3p@be1.lrz \
--to=harvested.in.lkml@7eggert.dyndns.org \
--cc=7eggert@gmx.de \
--cc=ebiederm@xmission.com \
--cc=jengelh@linux01.gwdg.de \
--cc=jesper.juhl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-os@analogic.com \
/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®