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

Classic playing nicer Classic
Frequently, the classic environment monopolizes the system. This makes the whole OS feel sluggish, because the the Window manager is trying to tear through all its code while sharing a huge number of resources with Classic. This happens on a lot of Unix platforms, and Windows as well. Unlike Windows, Unix and OS X provide a fine-grained way of alleviating this problem. It is called "renice". This command line tool wll allow you to finely control the priority of every program running on your system, including Classic. Typing "man renice" at the command line can give you detail descriptions of this tool, but I'll walk you through the basics (read the rest for the details...)

1.Start up a terminal app and create a terminal window, if one isn't created automatically.

2. At the command line type "ps -x" to list all your processes. You will get output that looks like:
  509  ??  Ss    16:43.58  Window Manager
510 ?? Ss 0:01.47 loginwindow
516 ?? S 0:00.80 pbs
520 ?? S 0:06.32 Dock
521 ?? S 0:16.99 Desktop
522 ?? R 1:54.70 Classic
523 ?? R 4:48.62 TruBlueEnvironme
645 ?? S 1:25.55 Clock
658 ?? R 85:03.91 LaunchCFMApp
682 ?? S 0:27.84 CPU Monitor
683 ?? S 0:17.42 ProcessViewer
691 ?? R 0:02.86 Terminal
697 std Rs 0:00.16 tcsh
The numbers on the right are the process ID's, which will be used in the renice command.

3. Using the renice command, increase the "nice" value of the TrueBlueEnvironment and Classic by finding their process ID's. In my case I would type:
renice +15 522
renice +15 523
This will take my setting from the default, 0, to 15. The largest number is 20. The larger the number, the lower the priority. At 20, the classic environment will only get a chance to run whenever nothing else is going on. At 15 you will get a little sluggishness inside of your classic environmnt when it is bogged down, but you won't notice the impact anywhere near as much on the rest of the system.

Be careful when setting your levels however. Only root, or superuser, are able to raise the priority of a task. If you want to return Classic back to normal, by doing something like:
renice 0 522
renice 0 523
then you will have to be logged into your shell as superuser.

[Editor's note: A great explanation of what renice does, and how it works! You can use Nicer (linked at left) to access the renice program throught the GUI]
    •    
  • Currently 2.13 / 5
  You rated: 2 / 5 (8 votes cast)
 
[10,229 views]  

Classic playing nicer | 3 comments | Create New Account
Click here to return to the 'Classic playing nicer' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
shell script to renice Classic
Authored by: Anonymous on Dec 29, '00 03:33:59PM

I wrote a simple shell script that does this for you:

============= begin renice_classic.sh ===============
#!/bin/sh

set -- `ps -x -o pid,command | egrep ' (Classic|TruBlueEnvironme)$'`

while [ $# -gt 0 ]
do
echo "renice +15 $1"
shift; shift
done

============= end renice_classic.sh ===============



[ Reply to This | # ]
shell script to renice Classic
Authored by: bozhe_moy on Dec 19, '01 04:09:11PM

This script doesn't work on my system. It finds PID correctly but just
produces the echo of the command like renice +15 301 and nothing happens. Give me prompt back but it doesn't execute anything.
What is wrong?

Ia lso had to use ps -xc instead of ps -x isnce it produces long paths
for porcesses



[ Reply to This | # ]
Renice script problems - explained
Authored by: klieb2002 on May 26, '02 08:51:47PM

The Unix script posted above is in a debugging form - a lot of Unix script writers create a script, and in the place where the real action happens - renice +15 $1 in this case - they simply echo what the command line would see and execute. That way you can run the script and be certain it will do what you want it to do before committing to doing it. So, to make this script functional you would need to remove the 'echo' from in front of the renice command.

By the way, under 10.1.4 it appears that the Classic environment only appears as a single process - there is no Classic process running in addition to TruBlueEnvironment. This makes it possible to remove the loop from the script above, which gets rid of the remaining errors in the script. The simplified script is then:

================= start of script ===============
#!/bin/sh

set -- `ps -x -c -o pid,command | fgrep TruBlueEnv | fgrep -v grep`

renice +15 $1

================= end of script ================

Even using renice to lower the priority of Classic doesn't really starve it of cpu cycles, however; it still grabs whatever is going unused by the other processes. I was hoping to lower the energy usage of Classic; I've noticed a direct correlation between my use of Classic mode under OS X, and the fan of the TiBook: the more you use Classic, the more the fan comes on. My guess is that the energy-saving strategies of Classic and OS X are incompatible in some way. If you think of a way to lower CPU usage on Classic further, please post a reply.



[ Reply to This | # ]