2

So far I've been using nice -n 10, but that's just sets the priority of the command I want to run low, but if there's no other process running at that time the command will take all the remaining cpu power and take as much as it wants.

But, is there any command or any way to limit how much processor a command can take?

Just as an analogy like in bittorrent I can limit how much bandwidth I want a certain download to take.

Thanks.

3

Yes, there are two ways to set hard limits even though not very mainstream since the purpose of the scheduler is to make sure a task completes as fast as possible.

  1. CPUlimit, which is not standard in most Linux distributions.
  2. Taskset, which allows you to bind a certain application to a specific core. In this second case doesn't specify a percentage but if you have 4 cores, you can bind the application to one core and it will be 25% usage.
  • Thank you for your response @Bogdan, any idea how CPUlimit can be installed in CentOS? – VaTo Mar 25 '16 at 17:32
  • You would have to compile it on CentOS just as described in the link I gave you. If this answers your question I would appreciate it if you accepted the answer. – Bogdan Mar 28 '16 at 4:12
  • That is good, however I was looking for something that came up with Linux and I don't have to compile it. Or a software that could be installed from the package manager. If there's none I will have to compile it, try it and then I can accept the answer. – VaTo Mar 29 '16 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.