Mailinglist Archive: opensuse (3767 mails)

< Previous Next >
Re: [SLE] maximum nproc value
  • From: Steve Graegert <graegerts@xxxxxxxxx>
  • Date: Thu, 2 Feb 2006 15:56:33 +0100
  • Message-id: <6a00c8d50602020656x1dd9660et7b3fe0ad6b18139c@xxxxxxxxxxxxxx>
On 2/2/06, Michael Green <mishagreen@xxxxxxxxx> 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 <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>

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 <graegerts@xxxxxxxxx>
Software Consultant {C/C++ && Java && .NET}
Office: +49 9131 7123988
Mobile: +49 1520 9289212

< Previous Next >
Follow Ups
References