ghostplant
ghostplant

Reputation: 87

About limiting the number of file descriptors

I have a question about limiting FD(file descriptors):

when I am using "ulimit -n 1000000", it means that the program is allowed to use at most 1000000 FD resources,

However, "cat /proc/sys/fs/file-max" shows that 803766 FDs are available in total, which is smaller than 1000000.

So, what's the number of FD on earch that the program is able to use, 1000000 or 803766?

Upvotes: 1

Views: 414

Answers (1)

Krzysztof Krasoń
Krzysztof Krasoń

Reputation: 27466

/proc/sys/fs/file-max takes precedence over any ulimit settings in the shell.

More over /proc/sys/fs/file-max is the total number of FD open for ALL processes on given machine.

ulimit settings are per process, so any new process started will have given limit (unless the total form file-max is exceeded in the system).

Upvotes: 2

Related Questions