General pid_max=0x8000 (can be changed), so the maximum value of the process number is 0x7fff, that is, 32767.
Process number 0-299 is reserved for the daemon process.
Now the kernel does not seem to have this limitation, "Linux kernel design and implementation" said in order to be compatible with the old version of Unix and Linux, the maximum PID default is 32767 (short int maximum), if you need to also do not consider and the old version of compatibility, modify/proc/ Sys/kernel/pid_max to increase the upper limit with echo to write a value to this file.
Since the general machine cannot run so many processes + threads at the same time, so 32768 is sure enough, but the system tends to allocate unused PID to the new process, so you will find that on the running system, there are many low PID is not used, because the start of the PID is used by other programs, Of course, you really have the ability to use the maximum PID, the system also has the solution, that is, from the beginning (low) search unused PID allocated to the new process.