linux 服务端程序很多都是以守护进程的方式对外提供服务, linux 系统本身也有很多守护进程,例如kthreadd用来创建内核进程, kswapd是内存换页守护进程,flush是dump内存中的脏页面到磁盘,jbd提供ext4文件系统的日志日志功能…守护进程命名大部分都是以d结尾. 大部分守护进程都是以root方式运行,没有控制终端,运行在后台. 大部分守护进程都是进程组的组长进程以及会话的首进程,而且是进程组和会话中的唯一进程. 守护进程的父进程一般是系统1号进程,例如initd或者systemd.
This denotes the maximum number of file-handles a process can allocate. Default value is 1024*1024 (1048576) which should be enough for most machines. Actual limit depends on RLIMIT_NOFILE resource limit.
NR_FILE is the limit on total number of files in the system at any given point in time
NR_FILE 是系统在某一给定时刻,限制的文件总数
While initializing the kernel we setup the vfs cache with start_kernel vfs_caches_init(num_physpages); files_init(mempages); fs/file_table.c says /* One file with associated inode and dcache is very roughly 1K.
Per default don’t use more than 10% of our memory for files. n = (mempages * (PAGE_SIZE / 1024)) / 10; this n can never be greater than NR_FILE