免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1358 | 回复: 1
打印 上一主题 下一主题

File Descriptors per Process . [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-02-03 18:43 |只看该作者 |倒序浏览
File Descriptors per Process .







A file descriptor is a handle created by a process when a file is opened. There is a limit to the amount of file descriptors per process. In order to check the default limit of the system, you can use command:

1.ulimit -a # all limitations
2.ulimit -Sn # soft limit
3.ulimit -Hn # hard limit
If the file descriptor limit is exceeded for a process, you may see the error Too Many Open Files.

And if you want to change the limit per process temporarily, you can:

1.ulimit -n <desired_#> # both
2.ulimit -Sn <desired_#> # soft limit
3.ulimit -Hn <desired_#> # hard limit
To check the open files of a process, you can use command pfiles <PID>.

To check the run time limit of each process in Solaris, you can plimit <PID>(it seems this command is not supported in Linux). If you have the root permission and you want to change the limit of an process without killing or restarting the process, you can plimit -n <desired_#>.

It was said that it may be dangerous to set the soft limit higher than 256 or hard limit greater than 1024 due to limitations with the stdio library.If programs require more file descriptors, they should use setrlimit directly.

-------------
References:

1.File descriptors
2.Linux Increase The Maximum Number Of Open Files / File Descriptors (FD)
3.Linux / UNIX: List Open Files for Process
4.Princeton University Enterprise Servers and Storage, File Descriptors
5.plimit

论坛徽章:
0
2 [报告]
发表于 2012-02-03 18:44 |只看该作者
谢谢分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP