Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!ll-xn!cit-vax!mangler
From: mangler@cit-vax.Caltech.Edu (System Mangler)
Newsgroups: comp.unix.wizards
Subject: Re: Emacs process niced after awhile
Message-ID: <3157@cit-vax.Caltech.Edu>
Date: Sun, 5-Jul-87 21:30:07 EDT
Article-I.D.: cit-vax.3157
Posted: Sun Jul  5 21:30:07 1987
Date-Received: Mon, 6-Jul-87 00:42:15 EDT
References: <1257@wanginst.EDU> <757@cpocd2.UUCP>
Organization: California Institute of Technology
Lines: 31
Summary: p_nice * avenrun[0] => positive feedback in scheduler

In article <757@cpocd2.UUCP>, nate@cpocd2.UUCP (Nate Hess) writes:
> One way of "cheating" the autonicing is to manually nice the emacs to
> +1 before it acquires 10 minutes of CPU time.  Ultrix will see that the
> process has a nice factor, and not autonice it to +4 like it usually
> would.

One night an NP-complete optimization problem was running at nice 4,
and another, very impatient student wanted to get as much CPU as he
could for *his* 3-hour job.  He applied the above trick of nicing his
job to 1, and then he started up twenty infinite-loop jobs at nice 20.

The load average at this point shot up to 24.  The BSD scheduler sees
this, and cuts out niced processes much more sharply than usual, with
the result that the nice 4 job and the nice 20 jobs got no CPU time.
Served his purpose real well...

Knowing how strident this student could be, I let him have his way for
a while.  Meanwhile, though, "nice 4" jobs piled up, because none of
them could get runtime, and the load average kept increasing; a vivid
demonstration of the built-in instability of the BSD scheduler.
Eventually I had to kill all the infinite-loop processes.
(I caught so much hell for this, that even two years later I still
refuse to kill infinite loops without the owner's consent).

The kernel auto-nicing is a kludge.  It only checks cumulative user-mode
cpu time.  Things like "make" are untouched, as are "loop on EOF" jobs,
the most common type of infinite loop around here.  The infamous sendmail
"fork and write until disk full" runaway is doubly exempt because it runs
as root.  How useful...

Don Speck   speck@vlsi.caltech.edu  {seismo,rutgers,ames}!cit-vax!speck