Como alterar o número PID máximo do kernel?

Como alterar o número PID máximo do kernel?

O número máximo do PID padrão é 32768. Para obter esta informação digite:

cat /proc/sys/kernel/pid_max 
32768

ou

sysctl kernel.pid_max
kernel.pid_max = 32768

Agora, quero mudar esse número... mas não posso. Bem, na verdade posso alterá-lo para um valor menor ou igual. Por exemplo:

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

Mas não consigo fazer isso por um valor maior que 32768. Por exemplo:

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

Alguma ideia ?

PS: Meu kernel é Linux linux-6eea 3.0.101-0.35-pae #1 SMP Qua 9 de julho 11:43:04 UTC 2014 (c36987d) i686 i686 i386 GNU/Linux

Responder1

O valor só pode ser estendido até um máximo teórico de 32768 para sistemas de 32 bits ou 4194304 para sistemas de 64 bits.

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

informação relacionada