Ulimit is used to limit the resources occupied by the shell startup process, supporting the following types of restrictions: the size of the kernel file created, the size of the process data block, the size of the shell process creation file, the size of the memory lock, the size of the resident memory set, the number of open file descriptors, The maximum size of the allocation stack, CPU time, the maximum number of threads per user, and the maximum amount of virtual memory that the Shell process can use. At the same time, it supports the limitations of hard and soft resources.
Linux file descriptors can be found in the author's previous article: http://kumu1988.blog.51cto.com/4075018/1086210
With regard to the nproc limitations of Ulimit in RHEL6, RHEL6 and RHEL5 are somewhat different in detail:
Change the number of user-open processes under the current shell
As a temporary limitation, ulimit can act as a shell session that is logged on by using its commands, ending the limit at the end of the session and not affecting other shell sessions.
Modify limits.conf configuration file to take effect
[Root@kumu ~]# ulimit-a//view current Profile Ulimit Global factor
Core file size (blocks,-c) 0
Data seg size (Kbytes,-D) unlimited
Scheduling priority (-e) 0
File size (blocks,-f) unlimited< Br>pending Signals (-i) 1829
Max locked memory (Kbytes,-L)
Max memory size (Kbytes -m) Unlimited
Open files (-N) 1024
Pipe Size (bytes,-p) 8
POSIX message qu Eues (bytes,-q) 819200
Real-time priority (-R) 0
stack size (Kbytes,-s) 10240
CPU Time (seconds,-T) unlimited
MAX user Processes (-u) 1024
Virtual memory (kbyte S, v) unlimited
File locks (x) unlimited
[Root@kumu ~]# vim/etc/security/limits.conf
[ro Ot@kumu ~]# grep "^*"/etc/security/limits.conf
* Soft nproc 10240
* Hard Nproc 10240< br>* Soft NofilE 10240
* hard nofile 10240
[Root@kumu ~]#
Exit current user, log in again to allow previously modified limits to take effect
[Root@kumu ~]# Ulimit-n
10240
[Root@kumu ~]# ulimit-u //Discovery Nproc did not change like Nofile
1024
[Root@kumu ~]#
After Google search, RHEL6 introduced the configuration file/etc/security/limits.d/90-nproc.conf
(See the @ Yang Dehua Devin Article redhat5 and redhat6 root different ulimits)
# Default limit for number of user ' s processes to prevent
# Accidental fork bombs.
# RHBZ #432903 for reasoning.
* Soft Nproc 1024
[Root@kumu ~]#
We modify this file to try whether or not because of the file impact, modify the following
# Default limit for number of user ' s processes to prevent
# Accidental fork bombs.
# RHBZ #432903 for reasoning.
#* Soft nproc 1024
* Soft Nproc
[Root@kumu ~]#
Exit the current user, log in again to allow the previously modified limits to take effect, and execute the following command to find the modification successful
[Root@kumu ~]# Ulimit-u
10240
[Root@kumu ~]# Ulimit-n
10240
[Root@kumu ~]#
Therefore, if you want to modify the Nproc limit in the configuration file limits.conf is limited by the size of the Nproc value in the file/etc/security/limits.d/90-nproc.conf, but the shell terminal is not restricted
In addition, I suspect that if the use of the * number for the global user is affected by the size of the Nproc value in the file/etc/security/limits.d/90-nproc.conf, and if it is only for a user, it is not affected by the size of the file Nproc value
[Root@kumu ~]# vim/etc/security/limits.d/90-nproc.conf //restore system default settings
[Root@kumu ~]# cat/etc/security/limits.d/90-nproc.conf
# Default limit for number of user ' s processes to prevent
# Accidental fork bombs.
# RHBZ #432903 for reasoning.
* Soft Nproc 1024
#* Soft nproc 65535
[Root@kumu ~]# vim/etc/security/limits.conf //test only for one user (use root here)
[Root@kumu ~]# grep ' ^root '/etc/security/limits.conf
Root soft nproc 10240
Root hard nproc 10240
[Root@kumu ~]#
Exit the current user, log in again to allow the previously modified limits to take effect, and execute the following command to find the modification successful
[Root@kumu ~]# Ulimit-u
10240
[Root@kumu ~]# Ulimit-n
10240
[Root@kumu ~]#
The author had guessed correctly that only when using the * number to make the global user effective, the value of the effective Nproc is the file/etc/security/limits.d/90- Nproc value size in nproc.conf is not affected by the size of the file Nproc value if it is only for a user.
This article is from the "Dead Wood Linux column" blog, please be sure to keep this source http://kumu1988.blog.51cto.com/4075018/1091369