Maximum PID in Linux

后端 未结 4 1961
抹茶落季
抹茶落季 2020-12-02 12:38

I am porting an application from Tru64 to Linux and it uses PID_MAX defined in limits.h. Linux doesn\'t have that define. How do I find PID_MAX in c withou

4条回答
  •  庸人自扰
    2020-12-02 13:42

    From the proc(5) man page:

    /proc/sys/kernel/pid_max (since Linux 2.5.34)

    This file specifies the value at which PIDs wrap around (i.e., the value in this file is one greater than the maximum PID). PIDs greater than this value are not allocated; thus, the value in this file also acts as a system-wide limit on the total number of processes and threads. The default value for this file, 32768, results in the same range of PIDs as on earlier kernels. On 32-bit platforms, 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).

提交回复
热议问题