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

Using renice to speed up VPC5.0 Apps
I am not sure how much this actually speeds things up; it seems to make some difference, but I do not have benchmarking software installed to actually test.

In my Applescript that I use to activate VPC5.0, I include the following line after the activate...
  do shell script "sudo renice -20 `ps -x | grep 'Virtual PC 5.0' |
grep -v 'grep' | cut -f1 -d' ??'`"
[Note: Enter on one line with a space before the 'grep' command]

This re-nices the VirtualPC process to -20 (the highest priority). Note to do this, you need to do the following from the terminal:
  sudo visudo
and then add the following line to the file and save it:
  %admin ALL=NOPASSWD: /usr/bin/renice
What this does is allow any user in the admin group to run renice as root without entering a password.

If anyone has benchmarking software, I would be interested on how much (if any) this makes a difference).
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)

Using renice to speed up VPC5.0 | 9 comments | Create New Account
Click here to return to the 'Using renice to speed up VPC5.0' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
FYI, per some email requests
Authored by: aelana on Jan 02, '02 10:03:38PM
Some folks emailed asking me to put up example Applescripts, so here they are...

The first one deals with just running my Windows98SE image:
tell application "Virtual PC"
activate virtual machine "Windows 98SE"
do shell script "sudo renice -20 `ps -x | grep 'Virtual PC 5.0' |
grep -v 'grep' | cut -f1 -d ' ??'`"
end tell
The second, activates the Windows98SE, waits for it to boot up if it has to and then runs ewallet software I use with my PDA:
tell application "Virtual PC"
activate virtual machine "Windows 98SE"
do shell script "sudo renice -20 `ps -x | grep 'Virtual PC 5.0' |
grep -v 'grep' | cut -f1 -d ' ??'`"
tell virtual machine "Windows 98SE"
repeat until process control is in integration services
delay 1
end repeat
execute "C:\\Program Files\\Ilium Software\\eWallet\\eWallet.exe"
end tell
end tell
[Editor's note: Both the 'do shell' commands have been broken onto two lines for readability; enter them as one line each.]

Hope these help...

[ Reply to This | # ]
Authored by: professor on Jan 03, '02 10:10:40AM

Doing "renice -20" is a *really stupid* idea, unless your objective
is to lock up your computer.

Try "renice -1" first. Normally, that should be sufficient. If not,
go for "renice -5" or "renice -10".

The baseline priority for user processes is "0"; "-1" is, therefore,
higher priority than all your other applications. (Which make for a nice
Hint: to get smoother playing Quicktime movies, do a "renice -1" on the
PID of

[ Reply to This | # ]
Authored by: babbage on Jan 08, '02 11:59:03AM
Nah, it's not *that* bad. I don't think the runlevel system in OSX works quite the same way that it does in other versions of Unix. Apparently in the Public Beta & up through 10.0.4, executing "nice" or "renice" didn't do much at all. under 10.1 it certainly does have an effect, but it's not so dramatic as to bring the rest of the system to a halt if you tell a process to run at level -20.

In certain cases that can actually be pretty useful: if I'm installing anything with Fink I'll do so at runlevel -10 or -20, just because compilation is painfully slow otherwise, but I'm still able to do work in another terminal window, use the web browser, play iTunes, etc at the same time. Likewise, I keep setiathome running at level -20 in the background, and the foreground processes don't have much of a noticeable slowdown.

I would be reluctant to run any big processes at such a high priority -- Classic, IE,, etc -- and it's possible that a future version of the operating system *will* "fix" the runlevel system in such a way that a -20 process will monopolize the system, just as you are describing. But as things stand now it does seem pretty harmless to do this. Try it before you complain! :)

[ Reply to This | # ]

using sudo visudo
Authored by: loren_ryter on Jan 03, '02 08:07:26AM

according to "man visduo," using sudo visudo is potentially very destructive--doing the wrong thing could mean not being able to use the sudo command again.

unfortunately "man visudo" doesn't explain how to edit the file very cleary--only that it can be dangerous and visudo protects against doing the wrong thing.

So... could anyone clearly explain how to use that and add the line for renice safely and correctly?

[ Reply to This | # ]
using sudo visudo
Authored by: aelana on Jan 03, '02 09:35:54AM

Note, as with anything potentially destructive, make a backup copy of the file (in this case /etc/sudoers)... (if for some reason things get mudged up, you can always enable root and copy the file back).

Ok once you are in the visudo editor, you will want to arrow down to the last line of the file and type $a then press <return> then type %admin ALL=NOPASSWD:/usr/bin/renice then hit <esc> and type :wq and press <return>, if all goes well you should be back at the command prompt.

[ Reply to This | # ]
Using visudo
Authored by: pmccann on Jan 03, '02 11:34:05AM

Oh the pain, the pain of it all....

(Having typed in three longish paragraphs of comments about using vi, about how vi *is* the only allowed editor for visudo on macosx (due to the --with-env-editor not being set at compile time), and various other dribs and drabs about how visudo does a very nice consistency check on the way out of the editor I must have had the "escape" key on the brain. And I hit it: in IE5 that zeroes out the text area into which you're currently typing. No reversal of this action that I could find. (Anyone?))

Ouch. Just like ":q!". Back to scratch. So this miserable little bleating is taking the place of "the one that got away". Damn it was a *great* message:-) And big? Oh boy... you should've seen it....

Paul (and jealous jeers to those attending MWSF in a few days!)

ps One day, not too far down the track, I'm going to learn to first type a comment in bbedit, and then use the technological marvel known as "cut and paste" to poke the text into the browser. Make it a new year's resolution!

[ Reply to This | # ]
Completely pointless
Authored by: sjonke on Jan 03, '02 05:06:00PM

There is no point in using renice on VirtualPC. The developers of VirtualPC (Connectix) have said this and I just tried it anyway and not only did it not help, it actually made it seem slower. Certainly everything else is slowed to a crawl if you give VirtualPC the highest priority, and that includes OS X's window manager. For an appreciable speedup, simply switch VirtualPC into full screen mode. That will make a noticeable (and positive) difference (aside from making you feel ill at the site of Windows taking over your Mac OS X screen), no renice necessary.

[ Reply to This | # ]
Completely pointless
Authored by: aelana on Jan 03, '02 11:05:20PM

Ah well, at least I learned a bit of Applescript in the process... :( I was hoping. As I had said in my original post, I wasn't sure it would make a difference and didn't have benchmarking software to find out. Thanks for letting us know.

Sorry for leading people down the wrong track.

[ Reply to This | # ]
Completely pointless
Authored by: sinjin on Feb 15, '02 06:47:22PM

You seem to have some useful information from the folks at Connectix, something I have had no luck with. Where do they say that renice does not work? I can't find anything in the "Knowledge Database" section of on this topic (or any useful topic for that matter).

Thanks in advance.

[ Reply to This | # ]