1

I have checked two linux systems, both were of 64 bit but PID_MAX is different for both of them.

On one system

cat /proc/sys/kernel/pid_max
32768

Whereas on other, it was

 cat /proc/sys/kernel/pid_max 65536

From proc man pages.

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).

Please note, both of these system were having same linux kernel.

Now, my question is what are factors which are responsible for changing pid_max? Thank you in advance.

2 Answers 2

0

If I remember correctly the default value is calculated from the max potential number of CPUs(rhel).

Run this command on each of the systems

dmesg | grep -i smp.*allow

Alternatively it's possible that the limit was changed by an admin previously?

3
  • on first system, this command gives me blank output whereas on second it says, "SMP: Allowing 64 CPUs, 61 hotplug CPUs". How does that maked difference, please explain. Commented Sep 22, 2016 at 3:08
  • pid_max = min(pid_max_max, max_t(int, pid_max, PIDS_PER_CPU_DEFAULT * num_possible_cpus())); Commented Sep 24, 2016 at 18:25
  • PIDS_PER_CPU = 1024. The default value will be 32768 or num_possible_cpus(64)*1024 which ever is higher. Commented Sep 24, 2016 at 18:27
0

Could it be that you are accessing a docker or open VZ container and not a real linux machine ? In such a case, the host can limit PID_MAX to any value. This is a relatively new feature, and it is called Cgroup pid controller. It is a kind of anti fork bomb solution, which prevents the container from endlessly forking processes, which will make the host unusable in a very short time.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .