Skip to content

784956 Processes

July 16, 2009

This week we had a customer claiming that they were unable to create more then 60,000 processes. This turned out to be due to them tuning max_nproc, maxuprc and maxpid but not setting segkpsize so the system would run out of “memory” before it ran into the resource limits for process.

Tuning segkpsize to 8G resolved it but I just had to see how many processes I could get running on an M8000.

Using these settings in /etc/system:

set segkpsize=0x300000 
set pidmax=999999 
set maxuprc=999990 
set max_nprocs=999999

and a simple forker program:


main(int argc, char **argv)
        pid_t pid;
        int count=0;
        while(count < argc == 2 ? 100 : atoi(argv[1]) &&
            (pid = fork()) != -1) {
                if (pid != 0 ) {
                        /* Parent */
                        if (count % 1000 == 0)
                                printf("%d\n", count);
                } else {
        if (pid < 0)
        printf("%d\n", count);

I was slightly disappointed at the result:


$ ./forker 100000
fork: Resource temporarily unavailable

Only 784956 processes, plus the ones already running when the system booted. Trying to count them with ps obviously fails but mdb gives the real count.

# ps -e| wc
ksh: cannot fork: too many processes
# echo nproc::print -d | mdb -k  

Someone must have managed to get more.


From → Solaris

  1. rmrf permalink

    Hi , how much memory in your M8000?

  2. # prtdiag | less
    System Configuration: Sun Microsystems sun4u Sun SPARC Enterprise M8000 ServerSystem clock frequency: 960 MHz
    Memory size: 229376 Megabytes

  3. rmrf permalink

    but you set segkpsize=0x300000 which means 3*1024*1024* 8-Kbyte pages
    That is 24Gbytes . why not use more memory ,you have 229376 Megabytes in total all.

  4. That is because segkpsize is validated to be no more than 24Gb see:
    So unless I build my own kernel that is as big as it gets.

  5. I squeezed a few more process in by starting from milestone none so that there were a minimum number of system processes running.
    # echo nproc::print -d | mdb -k
    and impressed that ps is so fast:
    # time ps -e > /dev/null
    real 0m14.59s
    user 0m2.74s
    sys 0m11.84s

  6. rmrf permalink

    OK, Thank you Chris

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: