Linux OS Internals (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What are File Descriptors and the "Too many open files" error?
senior LevelSystem Design
In Simple Words: Every open file, network socket, pipe, or device in Linux is represented by a non-negative integer called a File Descriptor (FD):
- Standard FDs:
0(stdin),1(stdout),2(stderr). ulimit -n: The maximum number of open file descriptors allowed per process (default often 1024).- When a web server (Nginx/Node.js) exceeds this limit under high connection load, it throws:
EMFILE: Too many open files. - Fix: Increase limits in
/etc/security/limits.conf(e.g.nofile 65535).