Explain the value range of pid in linux system in detail.
General PID_MAX=0x8000 (changeable), so the maximum value of the process number is 0x7fff, that is, 32767.
The process number 0299 is reserved for the daemon process.
The current kernel does not seem to have this restriction. "linux Kernel Design and implementation" says that in order to be compatible with older versions of unix and linux, the maximum value of pid is 32767 by default (the maximum value of short int). If you need to, you can not consider compatibility with the old version, modify / proc/sys/kernel/pid_max to increase the upper limit and use echo to rewrite a value to this file.
Since it is impossible for ordinary machines to run so many processes + threads at the same time, 32768 is certainly enough, but the system tends to allocate unused pid to new processes, so you will find that on running systems, there are many low-level pid that are not used, that is because the pid has been used by other programs at startup, of course, you really have the ability to use the maximum value of pid, and the system also has a way to solve it. That is to start from scratch (low order) to search for unoccupied pid assigned to the new process.
Summary
The above is the value range of pid under the linux system introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply you in time. Thank you very much for your support to the website!