D
D
DVoropaev2017-11-02 10:55:52
linux
DVoropaev, 2017-11-02 10:55:52

Why does Linux have a limit on the number of open files?

Linux, and probably all other Unixes (correct me if I'm wrong) have a /proc/sys/fs/file-max file that has a ceiling on the number of open files.
I have three questions:

  1. Why is this needed?
  2. How is this number chosen?
  3. Is it possible to set different values ​​for different users?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Gornostaev, 2017-11-02
@sergey-gornostaev

There is a limit on the number of open files in all operating systems, including Windows. And it is needed because a descriptor is created for each open file in a special memory area of ​​the operating system kernel. This area is not unlimited, and if it is exhausted, the system can spill out into a crust . No one likes an operating system that you can fill up just by opening files and not closing them.

P
Puma Thailand, 2017-11-02
@opium

To prevent processes from opening files
Empirically
You can set limits in limits

S
Sly_tom_cat ., 2017-11-02
@Sly_tom_cat

This is a simple precaution and a deliberate rake for those developers who do not close file descriptors in their programs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question