Limit the CPU usage of a certain application in Linux

By | July 9, 2009

You can do this by installing cpulimit. You can limit a certain running application either by name or by process ID:

cpulimit -e firefox -l 30

This won’t let Firefox go beyond a 30% CPU usage limit.
If you’d rather go by process, you can do it like this:

cpulimit -p 3493 -l 40

This will limit process number 3493 to 40% CPU consumption.

Passing 640-802 exam is no more difficult with help of examsheets online training with most up to date 70-680 training resources.

18 thoughts on “Limit the CPU usage of a certain application in Linux

  1. Pingback: Remains of the Day: Life After Cable TV Edition [For What It's Worth] · TechBlogger

  2. James

    Awesome tool! Thanks!

    Do you have any ideas for limiting the memory usage of a process?

    Reply
  3. Pingback: Tech Whiz Underground » Remains of the Day: Life After Cable TV Edition [For What It's Worth]

  4. Pingback: Control CPU hogs with CpuLimit « Linux & Stuff

  5. Pingback: Remains of the Day: Life After Cable TV Edition [For What It's Worth] | Superstars Of Gaming

  6. fwolf

    @ James: yes, according to this reply in comp.os.linux.misc there should be an option to limit memory using getrlimit.

    For the Ubuntu users: This util apparently is contained in the package libbsd-resource-perl (according to apt-cache: perl BSD::Resource – BSD process resource limit and priority).

    cu, w0lf.

    Reply
  7. name

    You never give credits when you find a story on some small blog? I’ll be waiting around the corner…!

    Reply
  8. T4L Post author

    PS: mi-a placut faza cu “te astept dupa colt” :))

    Reply
  9. Jorge Sousa

    (James comment): If you limit the process memory, one of 2 happens: programs ends because of lack of memory with a crash, or if supported, a error message.

    Reply
  10. Pingback: Remains of the Day: Life After Cable TV Edition [For What It's Worth] | Key To Eden

  11. T4L Post author

    @Jorge: that depends on how much memory the application is using. If it doesn’t pass that maximum required by the application being limited, then all should be fine. If it does pass that certain limit, then yes, one of the two things you mentioned will happen.

    Reply
  12. Pingback: Limitar el uso de CPU en aplicaciones Linux | Un Mundo Libre

  13. Pingback: Hannes (rebugger) 's status on Wednesday, 15-Jul-09 18:14:29 UTC - Identi.ca

Leave a Reply

Your email address will not be published. Required fields are marked *