這是在閱讀另外一個產品的告警指導書時,無意中發現 pid_max 這個參數。
原來Linux內核對于進程的數量使用 pid_max 做控制。
做一些簡單的試驗,如下演示獲取當前配置值的方法:
# cat /proc/sys/kernel/pid_max 32768 # sysctl -a|grep pid_max kernel.pid_max = 32768
如下是 sysctl 命令的幫助。
# sysctl -h Usage: sysctl [options] [variable[=value] ...] Options: -a, --all display all variables -A alias of -a -X alias of -a --deprecated include deprecated parameters to listing -b, --binary print value without new line -e, --ignore ignore unknown variables errors -N, --names print variable names without values -n, --values print only values of a variables -p, --load[=] read values from file -f alias of -p --system read values from all system directories -r, --pattern select setting that match expression -q, --quiet do not echo variable set -w, --write enable writing a value to variable -o does nothing -x does nothing -d alias of -h -h, --help display this help and exit -V, --version output version information and exit For more details see sysctl(8).
參考資料:
linux 進程數最大值修改 https://www.jb51.net/article/143664.htm
詳解linux系統下pid的取值范圍 https://www.jb51.net/article/143665.htm
Linux創建進程達到65535的方法 https://www.jb51.net/article/143667.htm
總結
以上所述是小編給大家介紹的Linux下進程數量的限制pid_max的配置方法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網站的支持!