System maximum FD number and maximum FD number in process

Source: Internet
Author: User

File descriptor, FD?

When each program opens a file, the system returns a file descriptor, which the program needs to reference in order to process the file, referred to as FD. FD is an integer, starting with 0, where 0 is the standard input, and 1 and 2 are standard output and standard error output, respectively. printf, for example, uses stdout by default. FD is a process-per-process unit with a maximum number of FD, which can be set using the Ulimit.

When a process attempts to open a new file by using an open function, the kernel open finds a collection of file descriptors for the current process, looks at whether the allocated file descriptor exceeds the maximum value of the process, and if the maximum value is not exceeded, assigns an FD to the process and then processes the file's read/ Write functions can refer to this file descriptor.

Similarly, in the open function, the total number of FD in the system is also checked for more than the setting in File-max, and if the maximum limit is exceeded, open fails.

How do I change the maximum number of FD limits for the system?

1) The system maximum value of FD is in/proc/sys/fs/file-max.

2) The maximum number of processes FD is set in Ulimit.

System maximum FD number and maximum FD number in process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.