What is the maximum and minimum value for a PID (Process ID) on Linux and Solaris?
3 Answers
From http://www.alexxoid.com/blog/linux/getting-the-max-pid-value-for-linux-process.html:
To get the max PID value that can be assigned to Linux process, run the following command:
cat /proc/sys/kernel/pid_max
On most Linux machines, the default value is 32768 (= 215).
However, it can be set to any value up to 4194304 (= 222) if necessary. Servers might have a larger limit to avoid PID collisions, for example.
You've had, and accepted, a Linux answer. On Solaris, the maximum value of a process ID is a kernel tunable parameter — pidmax
in /etc/system
— that defaults to 30,000 and that can be set anywhere between 266 and 999,999. Note that this is not max_nprocs
, which is a kernel tunable parameter with a subtly different function.
-
You mentioned that
max_nprocs
is different, what's the difference? Mar 14, 2017 at 11:52 -
2@ffledgling
max_nprocs
limits the number of concurrent processes, regardless of whether unused pids are available or not.– jlliagreMay 18, 2018 at 10:26
The minimum is 1 and usually the maximum is 2^15
-
-
The minimum PID is actually 0, i.e. the kernel which isn't a process really ...– jlliagreJun 10, 2011 at 15:05
-
-
It doesn't need one but is given pid 0. Under Linux, I guess it is only shown as a PPID but under Solaris, there is definitely a /proc/0 entry and ps reports process 0 as "sched".– jlliagreJun 14, 2011 at 5:32
-
@jlliagre ubuntu has no
/proc/0
neitherps -p 0
works :), anyway, as a variable pid initializer, the best seems to be-1
Apr 17, 2016 at 21:36