Maximum number of processes

If you’re with some Linux background under you belt then probably the first command you would think about is ulimit -a. The same command exists under Solaris

root@root # ulimit -a
core file size        (blocks, -c) unlimited
data seg size         (kbytes, -d) unlimited
file size             (blocks, -f) unlimited
open files                    (-n) 32768
pipe size          (512 bytes, -p) 10
stack size            (kbytes, -s) 8192
cpu time             (seconds, -t) unlimited
max user processes            (-u) 19995
virtual memory        (kbytes, -v) unlimited

But there is a small difference. Whilst under Linux you are free to use it to change the maximum number of processes available to a single user, under Solaris it won’t work complaining:

ulimit: max user processes: cannot modify limit: Invalid argument

So what’s next? Remember that the maximum size of the process table depends on the total amount of physical memory installed in the system. This dependance is reflected in internal variable, called maxusers, and is determined at boot time.

#define MAX_MAXUSERS  4096u

if (maxusers == 0) {
      pgcnt_t physmegs = physmem >> (20 - PAGESHIFT);
      pgcnt_t virtmegs = vmem_size(heap_arena, VMEM_FREE) >> 20;
      maxusers = MIN(MAX(MIN(physmegs, virtmegs),

OpenSolaris source code

It is also used to set two other kernel variables: max_nprocs and maxuprc to describe the maximum number of process systemwide and the maximum number of processes an ordinary user can have respectively.

if (max_nprocs == 0)
     max_nprocs = (10 + 16 * maxusers);
if (platform_max_nprocs > 0 && max_nprocs > platform_max_nprocs)
     max_nprocs = platform_max_nprocs;
if (max_nprocs > maxpid)
     max_nprocs = maxpid;
if (maxuprc == 0)
     maxuprc = (max_nprocs - reserved_procs);

OpenSolaris source code

To display the current values form the console just run mdb to explorer these variables:

> maxusers/D
maxusers:       2048

> max_nprocs/D
max_nprocs:     20000

> maxuprc/D
maxuprc:        19995

To set the maximum number of processes a non-root user could have just update maxuprc value through either mdb or /etc/system file. Keep in mind that:

Whilst what I’ve said here is true both for Solaris 9 and 10 in Solaris 10 using “Resource Management” you could create more refined constrains to define the way a user can run his/her processes.

Posted on May 28, 2009 at 11:09 pm by sergeyt · Permalink
In: Solaris

Leave a Reply