Linux limits the CPU usage of user processes

Source: Internet
Author: User
Linux restricts the CPU usage of user processes-Linux Enterprise applications-Linux server application information. The following is a detailed description. I have searched a lot of materials and I don't have a good answer to this question. Most of them are using pam to limit user resources. One of them is the CPU time, but there is no CPU usage.

In fact, it is acceptable for a user process to run for a long time on a linux server. If the CPU usage is too high, other users will not be able to bear it, but it is likely that there is a problem with the user program. At this time, the system should automatically stop such a process from consuming system resources.

The simplest method is to discover a user process with CPU usage exceeding a certain limit through ps and then kill the process. This is very violent, the user finds that the process is likely to start again after it is killed, which is a vicious circle.

There is a way to compromise, instead of killing the target process, but adjusting its nice value as appropriate. For details, see the following shell program:
QUOTE:

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.