13

The default PID max number is 32768. To get this information type:

cat /proc/sys/kernel/pid_max 
32768

or

sysctl kernel.pid_max
kernel.pid_max = 32768

Now, I want to change this number... but I can't. Well, actually I can change it to a lower value or the same. For example:

linux-6eea:~ # sysctl -w  kernel.pid_max=32768
kernel.pid_max = 32768

But I can't do it for a greater value than 32768. For example:

linux-6eea:~ # sysctl -w  kernel.pid_max=32769
error: "Invalid argument" setting key "kernel.pid_max"

Any ideas ?

PS: My kernel is Linux linux-6eea 3.0.101-0.35-pae #1 SMP Wed Jul 9 11:43:04 UTC 2014 (c36987d) i686 i686 i386 GNU/Linux

drpaneas
  • 2,320

1 Answers1

16

The value can only be extended up to a theoretical maximum of 32768 for 32 bit systems or 4194304 for 64 bit.

From man 5 proc:

/proc/sys/kernel/pid_max  
  This file (new in Linux 2.5) specifies the value at which PIDs wrap around
  (i.e., the value in this file is one greater than the maximum PID). The
  default value for this file, 32768, results in the same range of PIDs as
  on earlier kernels. On 32-bit platfroms, 32768 is the maximum value for
  pid_max. On 64-bit systems, pid_max can be set to any value up to 2^22
  (PID_MAX_LIMIT, approximately 4 million).
Jan
  • 7,772
  • 2
  • 35
  • 41