SUMMARY: nice command

From: Celeste M. Roy (
Date: Tue Jun 16 1992 - 18:19:29 CDT

...Sorry for the inconvenience to some for asking this question...
but thanks everyone for the help...

'nice' command summary:


> What I want to do is the following: I have a program that I want
> to run at the highest priority (bypassing Unix's aging algorithm
> in which processes start out at the highest priority and then
> gradually decrease cpu time the longer they run) (I think that's
> the way it works under SunOS ...?) Basically, I want my program
> have a static priority which is the highest so that it gets the
> most cpu time all the time. Can I accomplish this using the
> 'nice' command?

        Basically, you can use the nice command to change a
        process' "nice value". Nice'ing to have a higher
        priority than usual can ONLY be done by root. If a
        process is already running you can use the 'renice' command.

        As root use: nice -20 command
        or use: /usr/etc/renice -20 pid

        I used this and then I used 'ps -al' to check the nice value
        and the priority of the process. The priority of the process
        did increase (but it was not static- see below for reasons) and
        I also noticed the cpu time increase for the process.

Regarding bypassing Unix's aging algorithm:

kalli! offers the following:

        "Nice alters the way feedback on the process priority works -
        take a look at the Leffler, McKusich et. al. 4.3BSD book for
        a good thorough description of how it works.

        The big problem is that Unix process scheduling favors
        interactive (mostly sleeping) jobs due to its history as a
        timesharing system. In SVR4 you can alter this (feedback
        is contained in a table) or use the real-time class."

stern@sunne.East.Sun.COM offers the following:

"Nice will alter the starting priority, and give you preference (or make you less preferred) for scheduling, but it doesn't stop the priority decrementing on CPU-bound processes.

for this, you need either (a) the CONSULT-RTSCHED special from sun consulting (you need some good kernel experience to weld this in) or (b) Solaris 2.0, which has a fixed-priority real-time class scheduler." --- writes:

"You cannot bypass the Unix scheduling algorithm. However if you have root privelege, you can use nice to give the process a higher-than-normal "nice value". The scheduler uses the "nice value" and the current priority (and other things...) to determine what process should get the cpu next.

Wait until Unix has real-time capabilities or rewrite the scheduler..." ---- writes:

"I'm not sure that is the way it works any more -- It used to be if you got over a large number of CPU minutes (I think it was 800 under bad4.2) you were automatically reniced to low priority of +4 .(This annoyed some lisp programmers around here) I don't believe that is the case anymore as things like the xnews servers can chew up cpu time very quickly and they don't get downgraded." --- warns that making the nice value very negative can prevent the process from being interrupted. To regain control you must make the priority greater than zero. ------------------------------------------------------------------- also mentioned the 'top' command, available via archie, which also allows you to renice processes while running. I haven't checked into this yet...

Thanks to: kalli! stern@sunne.East.Sun.COM

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:43 CDT