"Deep Background" applications

Don Speck mangler at cit-vax.Caltech.Edu
Sun Jul 10 13:25:43 AEST 1988


A niceness of 20 is neither necessary nor sufficient by itself.

The low-level scheduler gives the CPU to the ready-to-run process
having the smallest value of p_pri.  Except during system calls,
this is the same as p_usrpri.  For a "Deep Background" process,
you want the largest legal value of p_usrpri, namely 127, even
in the absence of CPU ticks.  If you merely don't want to compete
with processes at nice 0, then 100 is enough.

N.B. "ps" and "top" display PRI = p_pri - PZERO (PZERO is 25).

In 4.2 BSD, p_usrpri works out to (in a *very* roundabout fashion
via a time recurrence in p_cpu):

	p_usrpri = PUSER + (nrscale*avenrun[0] + 9)*(p_nice - NZERO)/4

plus CPU ticks.  PUSER is 50 and nrscale is 2.	Notice that the effect
of niceness is multiplied by the load average.	Solving, we get:

		loadavg for p_usrpri of
     niceness	   --127--   --100--
	28	     1.0
	20	     3.2       0.5
	10	    10.9       5.5
	 4	    34	      20.5

Although 4.2 BSD doesn't allow a niceness of 28, it's easy enough
to modify donice().  Convex's version allows niceness up to 64.

The fact that any positive niceness can become "deep background"
at a sufficient load average makes it risky to "nice" anything
that has timeouts or holds some scarce resource.

System V doesn't seem to have a "deep background".

Don Speck   speck at vlsi.caltech.edu  {amdahl,ames!elroy}!cit-vax!speck



More information about the Comp.unix.questions mailing list