Web Design

Categorized | Applications, cli, System

Limit the CPU usage of a certain application in Linux

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.

Author Profile

T4L ;

Other posts by

Author's web site



Are you satisfied with this blog?
Why not subscribe our RSS Feed? you will always get the latest post.


11 Comments

  1. James

    Awesome tool! Thanks!

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

    1

  2. CPUlimit is in the Ubuntu repositories.

    sudo apt-get install cpulimit

    2
  3. Josue R.

    This is exactly what i was looking for, thanks.

    3

  4. @ 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.

    4
  5. name

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

    5
  6. T4L

    @name: …aaaaand by that you mean?

    6
  7. T4L

    @name: vad ca ai IP de Bucuresti :) Pai uite: scris de mine in 15 octombrie 2007: http://mylro.org/content/view/42/52/
    Lucram cu cpulimit de vreo 5-6 ani cand am scris postul de mai sus, asa ca chill ;)

    7
  8. T4L

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

    8
  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.

    9
  10. T4L

    @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.

    10
  11. MCSE

    nice tool thanks

    11

7 Trackback(s)

  1. 09 07 2009 : Remains of the Day: Life After Cable TV Edition [For What It's Worth] · TechBlogger
  2. 09 07 2009 : Tech Whiz Underground » Remains of the Day: Life After Cable TV Edition [For What It's Worth]
  3. 09 07 2009 : Control CPU hogs with CpuLimit « Linux & Stuff
  4. 10 07 2009 : Remains of the Day: Life After Cable TV Edition [For What It's Worth] | Superstars Of Gaming
  5. 10 07 2009 : Remains of the Day: Life After Cable TV Edition [For What It's Worth] | Key To Eden
  6. 10 07 2009 : Limitar el uso de CPU en aplicaciones Linux | Un Mundo Libre
  7. 15 07 2009 : Hannes (rebugger) 's status on Wednesday, 15-Jul-09 18:14:29 UTC - Identi.ca

Leave A Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>