On 2/2/06, Michael Green wrote:
What is maximum nproc value built into linux kernel?
I want to configure nproc in /etc/security/limits.conf as 20% of max.
What is the maximum allowable value?
Michael,
Technically, Linux (since 2.6) can handle up to around 1 billion PIDs,
but since you're asking for per a user setting use the following lines
of code:
#include
#include
#include
#include
int main(int argc, char **argv) {
long value;
errno = 0;
if ((value = sysconf(_SC_CHILD_MAX)) < 0) {
if (errno != 0) {
perror("sysconf error");
exit(1);
}
fputs("_SC_CHILD_MAX not defined.", stdout);
} else
printf("CHILD_MAX = %ld\n", value);
return (0);
}
Compile with
% cc nproc.c -o nproc
and invoke with ./nproc. I have no access to a Linux box right now,
but it should work.
\Steve
--
Steve Graegert
Software Consultant {C/C++ && Java && .NET}
Office: +49 9131 7123988
Mobile: +49 1520 9289212