About the nproc restrictions of ulimit in RHEL6

Source: Internet
Author: User
The nproc limit of ulimit in RHEL6 is used to limit the resources occupied by shell startup processes. the following restrictions are supported: the size of the created kernel file, the size of the process data block, the size of the file created by the Shell process, the size of the memory lock, and the size of the resident memory set... the nproc limit of ulimit in RHEL6 is used to limit the resources occupied by shell startup processes. the following restrictions are supported: the size of the created kernel file, the size of the process data block, the size of the file created by the Shell process, the size of the memory lock, the size of the resident memory set, the number of opened file descriptors, and the allocation stack. the maximum size, CPU time, the maximum number of threads for a single user, and the maximum virtual memory that a Shell process can use. At the same time, it supports restrictions on hard and soft resources. Www.2cto.com Linux file descriptor can see the author's article: http://www.2cto.com/ OS /201212/177127.html
Concerning the nproc restrictions of ulimit in RHEL6, RHEL6 and RHEL5 have some differences in details: changing the number of processes that a user can open in the current shell serves as a temporary limit, ulimit can be used to log on to a shell session by using its command. when the session ends, the limit is terminated and does not affect other shell sessions.

Modify the limits. conf configuration file to take effect [root @ kumu ~] # Ulimit-a // view the current configuration file ulimit global coefficient core file size (blocks,-c) 0 data seg size (kbytes,-d) unlimitedscheduling priority (-e) 0 file size (blocks,-f) unlimitedpending signals (-I) 1829max locked memory (kbytes,-l) 64max memory size (kbytes,-m) unlimitedopen files (-n) 1024 pipe size (512 bytes,-p) 8 POSIX message queues (bytes,-q) 819200real-time priority (-r) 0 stack size (kbytes,-s) 10240cpu time (Seconds,-t) unlimitedmax user processes (-u) 1024 virtual memory (kbytes,-v) unlimitedfile locks (-x) unlimited [root @ kumu ~] # Vim/etc/security/limits. conf [root @ kumu ~] # Grep '^ *'/etc/security/limits. conf * soft nproc 10240 * hard nproc 10240 * soft nofile 10240 * hard nofile 10240 [root @ kumu ~] # Log out of the current user and log on again to bring the modified limits into effect [root @ kumu ~] # Ulimit-n10240 [root @ kumu ~] # Ulimit-u // It is found that nproc has not changed 1024 like nofile [root @ kumu ~] # According to google search, the configuration file/etc/security/limits is introduced in RHEL6. d/90-nproc.conf (see @ Yang Devin's article redhat5 and redhat6 different ulimits for root users) [root @ kumu ~] # Cat/etc/security/limits. d/90-nproc.conf # Default limit for number of user's processes to prevent # accidental fork bombs. # See rhbz #432903 for reasoning. * soft nproc 1024 [root @ kumu ~] # If we try to modify this file because it affects the file, modify the following [root @ kumu ~] # Vim/etc/security/limits. d/90-nproc.conf [root @ kumu ~] # Cat/etc/security/limits. d/90-nproc.conf # Default limit for number of user's processes to prevent # accidental fork bombs. # See rhbz #432903 for reasoning. # * soft nproc 1024 * soft nproc 65535 [root @ kumu ~] # Log out of the current user and log on again to make the modified limits take effect. run the following command to check that the modification is successful [root @ kumu ~] # Ulimit-u10240 [root @ kumu ~] # Ulimit-n10240 [root @ kumu ~] # We can see that if you want to modify the configuration file limits. the maximum limit of nproc in conf is the file/etc/security/limits. the nproc value in d/90-nproc.conf is limited in size, but it is not restricted in shell Terminal. In addition, I guess that if the * number is used to make global users take effect, it is caused by the file/etc/security/limits. the nproc value in d/90-nproc.conf is restricted. if it is only for a user, it is not affected by the nproc value of the file. www.2cto.com [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. # See rhbz #432903 for reasoning. * soft nproc 1024 # * soft nproc 65535 [root @ kumu ~] # Vim/etc/security/limits. conf // test only for a user (root is used here) [root @ kumu ~] # Grep '^ root'/etc/security/limits. confroot soft nproc 10240 root hard nproc 10240 [root @ kumu ~] # Log out of the current user and log on again to make the modified limits take effect. run the following command to check that the modification is successful [root @ kumu ~] # Ulimit-u10240 [root @ kumu ~] # Ulimit-n10240 [root @ kumu ~] # I have guessed it is correct, that is, the nproc value that takes effect only when the * number is used for global users is affected by the file/etc/security/limits. the nproc value size in d/90-nproc.conf is restricted. if it is only for a user, it is not affected by the nproc value size of the file.
Related Article

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.