日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ulimit小结

發布時間:2023/12/2 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ulimit小结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1. limits是一個進程的資源,會被子進程繼承 ? 2. soft limit -S, hard limits -H hard limits只能被root用戶修改,啟動的時候會加載配置/etc/security/limits.conf soft limits可以被任何用戶修改,但不能超過hard limits ? 3. 在linux下,每個進程的limit信息保存在/proc/PID/limits文件中(linux OS?kenerl?> 2.6.24)。低于2.6.24版本的kenerl需要手動統計 /proc/PID/fd下面有多個少個文件。 ? 4. lsof -p pid顯示所有的打開文件包括shared library lsof 會統計一些duplicate的open file ? 5. system-wide fd sysctl -a vim /etc/sysctl.conf ? 6. max open file on the system cat /proc/sys/fs/file-max ? 7. stat the openning file from the kenerl point of view cat /proc/sys/fs/file-nr
864 ? ? 0 ? ? ? 3274116
have 864 out of max 3274116 open files


8.利用lsof統計每個進程打開的文件數目
lsof -n |awk '{print $2}'|sort|uniq -c |sort -nr|more?

9. 設置普通用戶下打開文件的最大值
?ulimit -n 4096
-bash: ulimit: open files: cannot modify limit: Operation not permitted
9.1 在/etc/security/limits.conf中添加
* hard nofile 100000
* soft nofile 100000
9.2 /etc/pam.d/login 添加 session required /lib64/security/pam_limits.so 9.3 重啟 ssh2和rccron,這樣只進程就自動繼承了nofile
/etc/init.d/ssh2 restart
rccron restart 參考文獻: 1.?http://blackbird.si/checking-limits-of-a-linux-process-ulimit/ 2.?http://stackoverflow.com/questions/34588/how-do-i-change-the-number-of-open-files-limit-in-linux 3.?http://geekswing.com/geek/quickie-tutorial-ulimit-soft-limits-hard-limits-soft-stack-hard-stack/ 4.?http://stackoverflow.com/questions/1356675/check-the-open-fd-limit-for-a-given-process-in-linux 5.?http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/ 6.?http://mcmvp.blog.51cto.com/5497438/1257713 7.?http://www.myexception.cn/linux-unix/436451.html

轉載于:https://www.cnblogs.com/Torstan/p/4097638.html

總結

以上是生活随笔為你收集整理的ulimit小结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。