Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Set CPU usage limit per Parallels virtual machine Apps
I wrote a small free application called CpuLimiter which allows you to limit the CPU usage for a selected virtual machine running in Parallels Desktop or Parallels Server. The download file contains two programs:
  • cpu-limit which may be used in Terminal as a standalone app to limit any process, not just Parallels' virtual machines.
  • GUI, which wraps the cpu-limit in a traditional GUI application, and is suitable for most Mac OS users.
Installation is very simple -- just double-click the CpuLimiter-0.1.zip file, and drag the application to the Applications folder, or any other desired location. To start the program, just double-click it then select a running virtual machine from list and set the CPU limit in percentage. That is, to limit a VM's CPU usage to 20%, you'd enter 20. You can start as many instances of applications as you want to handle more than one virtual machine.

Please note that at least one VM should be running, so that the application can detect it. This works in Leopard with either Parallels Desktop 4 (build 3522 or higher) and Parallels Server 3 (build 2251 or higher). This is beta version 0.1, and I welcome any bug reports.

[robg adds: I haven't tested this one, beyond downloading the zip file and confirming its contents.]
    •    
  • Currently 2.38 / 5
  You rated: 4 / 5 (8 votes cast)
 
[14,305 views]  

10.5: Set CPU usage limit per Parallels virtual machine | 9 comments | Create New Account
Click here to return to the '10.5: Set CPU usage limit per Parallels virtual machine' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Set CPU usage limit per Parallels virtual machine
Authored by: jclin on Apr 08, '09 08:17:06AM

You should use kill() instead of invoking kill via system() call. The system() call needs more resources and causes overhead. It needs to fork, execute shell, and run the kill executable file. There should be many CPU usage introduced by the cpu-limit if there are many cpu-limit instances.



[ Reply to This | # ]
10.5: Set CPU usage limit per Parallels virtual machine
Authored by: john_g on Apr 08, '09 01:52:11PM

there is no system calls in cpu-limit
Only kill is in GUI from Apple Script, when you click Stop limiting CPU
CpuLimiter will be GPLed or BSDed :) , you will see the code



[ Reply to This | # ]
10.5: Set CPU usage limit per Parallels virtual machine
Authored by: john_g on Apr 08, '09 01:54:20PM

I meant kill system calls



[ Reply to This | # ]
10.5: Set CPU usage limit per Parallels virtual machine
Authored by: revision29 on Apr 08, '09 08:59:05AM

Can you make a variant for VirtualBox?



[ Reply to This | # ]
10.5: Set CPU usage limit per Parallels virtual machine
Authored by: john_g on Apr 08, '09 01:47:59PM

You can use cpu-limit from inside CpuLimiter.app->Contents->MacOS
usage is:
cpu-limit percentage(without %) process_pid
for example
cpu-limit 30 3455 (where 30 is percentage, 3455 is pid for Virtual Box VM)
Please note, I didn't test it personally, but I am working in this direction

To stop limiting
kill -s SIGTERM pid (for now pid is cpu-limit process pid)

Please note, when limiting, it is not suitable for playing games, or video,music, just to limit cpu usage for long term intensive tasks



[ Reply to This | # ]
you also can select only one CPU in Parallels
Authored by: Herve5 on Apr 09, '09 03:15:54AM

For a given VM in // you can also decide to allocate e. g. a single CPU. Granularity is not the same of course, but if the issue is leaving "enough for the mac" it'll work...



[ Reply to This | # ]
10.5: Set CPU usage limit per Parallels virtual machine
Authored by: gudlife on May 07, '09 04:14:19PM

Does this work on G5s as well? I just tried it out and got this:

/Applications/CpuLimiter.app/Contents/MacOS/cpu-limit 70 241

-bash: /Applications/CpuLimiter.app/Contents/MacOS/cpu-limit: Bad CPU type in executable

I want to smack compressor into compliance :)



[ Reply to This | # ]
10.5: Set CPU usage limit per Parallels virtual machine
Authored by: ktolis on Sep 01, '09 03:57:03AM

Could you PLEASE report a snow leopard compatible build ? This app is a must.. I wrote myself a hack for dnetc (which is included in it now) to limit cpu usage based on cpu core temperature (for the original G3 at that time) and would love to see it now for Snow Leopard. If you have a working binary, please contact me to port in the option for temperature-based limiting :)

thanks in advance



[ Reply to This | # ]
10.5: Set CPU usage limit per Parallels virtual machine
Authored by: starcrouz on Oct 10, '12 09:16:14AM
A little very late update to say I'm using Cpulimit, an opensource tool written by Angelo Marletta. I'm explaining how and why here on my blog (in french). Hopping it can be usefull for you folks.

[ Reply to This | # ]