How to change the kernel max PID number?
29,087
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).
Related videos on Youtube
Author by
drpaneas
Hardware Expert, Experienced User, Programmer and Engineer
Updated on September 18, 2022Comments
-
drpaneas over 1 year
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 over 9 yearsMy arch is x86, meaning 32-bit. So that's why I got this error. Thank you very very much sir.
-
fche about 9 yearsIt would be helpful to point at an explanation as to where those theoretical maximums come from.
-
mvorisek almost 6 yearsDebian 9 has default equal to 131072.