> On Wed, 18 Sep 2002, Linus Torvalds wrote:
>
> > I would suggest something like this:
> > - make pid_max start out at 32k or whatever, to make "ps" look nice if
> > nothing else.
> > - every time we have _any_ trouble at all with looking up a new pid, we
> > double pid_max.
>
> > + if (nr_threads > pid_max >> 4)
> > + pid_max <<= 1;
>
> ... but watch out for over/underflow. ;)
Actually, you can't overflow without having nr_threads be something like
27 bits, which means that you'd need to have 100 million threads active at
the same time.
Which, btw, is impossible anyway due to running out of memory to hold all
the thread data structures on a 32-bit architecture _long_ before you get
close to having a high enough nr_threads.
On a 64-bit architecture you can do it with enough memory, but even that
is a few years away (you'd need on the order of a couple of terabytes to
do it).
> It would also be nice if we had some known limit on pid_max (say 8
> million, fits in 7 digits).
Do the math. The above _will_ fit in 7 digits as long as you never have
more then about half a million threads active at the same time.
Which, practically speaking, means that we're done. Quite frankly, the
people who maintain machines that run millions of threads concurrently
care a hell of a lot more about the maching running _stable_ than about
"ps" being pretty.
The people who care about ps being pretty will probably never see more
than 5 digits.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/