[comp.unix.ultrix] How does one set the autonice feature?

buc@jessica.stanford.edu (Robert Richards) (08/22/90)

Large jobs get auto nice'd after a certain limit of CPU time.  Where
on the system is this value set?

Thanks.

        Rob Richards				  @ @ 
        Supercomputer & Workstation Support Staff   >
        AIR					   - 
	Stanford University

``Indeed he knows not how to know who knows not also how to unknow.''
	Sir Richard Francis Burton 

``I am (the) inferior of any man whose rights I trample underfoot.''
	Author Robert Ingersoll

mogul@wrl.dec.com (Jeffrey Mogul) (08/23/90)

In article <1990Aug22.010509.11821@portia.Stanford.EDU> buc@jessica.stanford.edu (Robert Richards) writes:
>
>Large jobs get auto nice'd after a certain limit of CPU time.  Where
>on the system is this value set?

This is left over from 4.2BSD (or even earlier).  The kernel
contains code in sys/kern_clock.c that looks like:
		/*
		 * Check to see if process has accumulated
		 * more than 10 minutes of user time.  If so
		 * reduce priority to give others a chance.
		 */
		if (p->p_uid && p->p_nice == NZERO &&
		    u.u_ru.ru_utime.tv_sec > 10 * 60) {
			p->p_nice = NZERO+4;
			(void) setpri(p);
			p->p_pri = p->p_usrpri;
		}
(This is taken from the 4.2BSD version; in Ultrix 4.0, it is
still there but has gotten a little more complex due to SMP support.)

I don't know of any way to undo this short of changing the kernel
code.  My recollection is that Stanford has an Ultrix source license,
so you should have no trouble changing this feature (it would probably
work to remove the entire "if" statement) -- at your own risk, of
course.  Other who are not so lucky might wish to file an SPR asking
for a hook to manage this feature.

Note that if the process's "nice" is already non-zero, this code
has no effect.  So, if you nice all your processes to, say, 1 or -1,
they will stay at that nice.  (Also note that super-user processes
are immune.)

-Jeff