linux和mac修改max_user_processes和open_file最大值

1. 进入/etc/security/limits.conf,编辑:

* soft nproc 65535

* hard nproc 65535

* soft nofile 65535

* hard nofile 65535

nofile对应open_files,nproc对应max_user_processes

2. 进入/etc/security/limits.d/90-nproc.conf(没有conf文件,自己新建)

* soft nproc 65535

* hard nproc 65535

* soft nofile 65535

* hard nofile 65535

保存后,输入ulimit -a查看。


对于mac os,修改这两个参数,open_file可以修改成很大的值,max_user_processes最大值只能是2128(基于mac os10.13 sierra系统测试)

参考:https://gist.github.com/tombigel/d503800a282fcadbee14b537735d202c

关于max_user_processes为什么不能和linux一样修改为65535这样大的值,mac官方曾给出过解释,处于安全考虑,8G内存最大值为2500,16g最大值可以设置5000,如果还想设置更大,则需要安装OS X Server.

https://apple.stackexchange.com/questions/140711/more-than-2500-systemwide-processes-on-osx-10-9




猜你喜欢

转载自blog.csdn.net/u012491783/article/details/80981481