nice, renice...

IamBob

Registered
I'm looking to write up a UI for getting/setting priorities. The UI and sending off commands isn't the hard part. I've been experimenting with nice an renice(after reading the manual) and still don't quite understand it. If someone knows how this works and can help that'd be great!

thanks.
 
I've played with renice as root with syntax like this:

[localhost:~] root# renice -20 1751
1751: old priority 0, new priority -20


The primary things I'd like to speed up are the window manager, and when I access the dock. Negative numbers are faster. I'm looking for GUI responsiveness, rather than database number crunching.

Siiems like the default settings are 0 for everything.
 
thanks for the response.

I noticed while messing with renice as an admin(not root) I can lower the priority on things but cannot raise them. I looked around for a while and found a link or two that said that is a bug. Not too much of a problem.

How do I get the priority of "PID" before I change it? Can it be done?

thanks again.
 
Well, the default is 0, so I'm assuming they're all 0, unless I change them. When you renice, it returns the previous and new value.

It's not like anything will conflict if there are several set to -20, the mach scheduler will just let them duke it out in a round robin fashion, just as if they were all 0 like before.

And you really wouldn't run around making everything -20 like ppp or anything like that.

I would avoid reniceing anything with a parent ID of 1, as so much will fall under that process (like Window Manager affects a lot of subordinate processes). Pick a subordinate process (like the dock, or the desktop) to renice, rather than a parent (windowmanager) to speed up the particulars.
 
I wrote up a GUI for renice...it works ok but I forgot to add the negative numbers. It shouldn't be hard to fix though. I just haven't got back to that project yet.

The reason I asked if there was a way to tell what the priorities are before you change them is cause I want to display that info as well. I'd like to be able to see what processes are running at what priority so I could make a more informed decision.

well, thanks.
 
Okay, I figured it out...

I'm using "ps axO ppid,nice,user" to get the info I need to displa. This gets put into a table where the user can select an item to renice. This way I can keep the table updated without much extra work and zero guessing(ntpd is always at -12?).

This program gives me a quick way to modify priorities without having to use Terminal. By tuesday I should have the dev tools to work with as well.

thanks for the help!

[edited for clarity. I had been up since 3:00am and was groggy...shh!]

[Edited by IamBob on 11-06-2000 at 08:26 PM]
 
Only root can 'renice' to a higher priority - this stops your average joe user from bumping up his job's prority at the expense of other processes. Hence the name 'nice' and not 'nasty' !!

BTW I wouldn't recommend renicing anything to -20 ! That basically means that job gets the CPU and other jobs be damned !
 
Well, all the apps I've reniced to -20 are the apps I work with constantly, like OmniWeb and the Desktop...stuff that I want to steal all the cycles they can because they're part of the GUI or depend on displaying something.
 
Are you going to post this GUI that you're making for the nice and renice commands? I use the commands sometimes, and think that you're program would be very useful.

Little utilities like yours are needed, just like the "big applications"
 
I wouln't up any process priority to -20 because you could hog the CPU and not give time to other very important administrative processes: cron, netinfo, lookupd and stuff

MacOS does not give you this flexibility, so your Finder response is sometimes suboptimal (the OS is doing stuff on the background) and you can do nothing about. MacOS X gives you complete control, but be mindful...

dani++
 
I'm almost done with it. I'm trying to work around a repaint bug(?) and the server I'm using now won't let me upload anything...looking for a new host.

Some info can be had at http://www.1avenue.com/thenamethief/

I hope to add more to it in the next couple weeks. Things that *need* to be inlcuded are Inspector and lock/unlock box. I'd like to extend the functionality of it to include process killing. The force quit(option+command+esc) that's built in doesn't always kill the process and only makes it appear as though it's not running. I've had Classic go bonkers a few times leaving me no other choice but to really 'kill' it from the command-line. The "average Joe" shouldn't need to do that...bad Apple!

Any ideas as to what else I could include?

thanks.
 
Add an automatic kill function to any process named True Blue Environment that maintains >97% CPU for more than x minutes (x>3?). This could solve all the problems with people claiming they have crashed OSXPB when all that has happened is the classic environment/gui has messed up. Perhaps it could autolaunch a dialog saying "foo appears to have crashed. Would you like to quit this application. Warning: all unsaved changes will be lost!"

I have my system set to launch terminal at login and I minimize it into the dock so that I can easily get a terminal window launched whenever I need to kill Classic/Trueblue Environment (~once per day).

Your utility if set up right could be designed to fix the common "crashes" that occur without requireing someone to telnet/ssh from another computer and kill processes.

On the other hand, these problems should be fixed in the release version of OS X rendering this feature of your utility useless.

Either way this type of utility sounds very important as people running OS X on a slow machine who dont want their MP3's to skip could assign a higher priority that application to accomplish their goal. I can imagine many other situations where people need to get the max performance of their apps and will be able to tweak the priorities to accomplish their goals.

Are you planning to make this open source? What language are you writing it in?
 
Back
Top