歡迎您光臨本站 註冊首頁

File Descriptors per Process .

←手機掃碼閱讀     火星人 @ 2014-03-03 , reply:0

File Descriptors per Process .

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 # both
2.ulimit -Sn # soft limit
3.ulimit -Hn # hard limit
To check the open files of a process, you can use command pfiles .

To check the run time limit of each process in Solaris, you can plimit (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 .

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
《解決方案》

謝謝分享

[火星人 ] File Descriptors per Process .已經有445次圍觀

http://coctec.com/docs/service/show-post-1024.html