renice command

Posted:
in macOS edited January 2014
Can I use to the "renice" command in OS X to give an app like (a CPU intensive game such as America's Army) an added boost?



Does OS X use the Linux-like range of CPU priorties of 19 to -20? (negative 20 being a HIGER level than 19..FYI)



How can I tell which priority level an app usually runs at before I try and raise/lower it?

Comments

  • Reply 2 of 6
    baumanbauman Posts: 1,248member
    I don't think it will make that big of a difference, quite honestly. The way the command line app works is you type something like renice value pid, where value is a number between -20 and 20, and pid is the process of the app you want to change. The way they do it is a little backwards... -20 is high priority, and 20 is low. All user run apps begin with a priority of 0 unless the app is coded to be different.



    Interestingly enough, you can lower the priority (increase the number) as much as you want, but you need root privileges to raise the priority (lower the number). So for example, if the pid of America's army is 980, to make it the highest priority, you would type: sudo renice -20 980 and enter your password.



    But really, if you don't have any other apps running to begin with, it shouldn't make any difference in the world. The system only takes about 2% CPU on my machine when I'm not messing with the finder, and I would imagine that's running at highest priority to begin with since the system needs to be running.
  • Reply 3 of 6
    scottscott Posts: 7,431member
    The nice level depends on the shell you are using. some do -20 to 20 others do 0 to 40. Read the man page to know.



    As stated above though it may not help you that much. If nothings running your process will get all the CPU no matter what level you set it to.
  • Reply 4 of 6
    I have heard one should not set a process to -20, but rather -19, as -20 may lock the system under certain circumstances. -19 allows other processes to run if they need to.
  • Reply 5 of 6
    thuh freakthuh freak Posts: 2,664member
    here's how i think of the niceness, to make up for its being counter-intuitive. a highly nice program (+20), is nice enough to give up cycles to other programs whenever they need em. where a mean program (nice = -20) doesn't like to share the proc.



    i'm gonna go against the grain and say that nice values can significantly affect your computer. the other day, i was at my friends house download "legal" files from the "internet" in one program. simultaneously we were viewing "legal" websites in another program. plus, we also had "limewire" open (for reasons i am currently unaware), and itunes with the visualizer. limewire + bittorrent took up a lot of the proc. and itunes would grab a lot too, so it was basically in constant use over 90%. we lowered itunes priority (+15 niceness), upped bt's (-20 niceness), and lowered the rest of the programs priorities (varying from +5 -> +15), and bt started download significantly faster. it went from avg'ing <5k/s, to >110k/s. but, if your comp is only running one app, plus the finder, nicing isn't going to do a heck of a lot.



    also, although there is a theoretic danger in making the nice value -20, i've never had a system lock up because of it.
  • Reply 6 of 6
    scottscott Posts: 7,431member
    Yea that's what happens when you have other things running. BUT when other things are not running and eating CPU, say you're playing a game, then the game gets 99% of the CPU without touching the priority.
Sign In or Register to comment.