Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!internet!Larry Allen From: Larry Allen Newsgroups: net.unix-wizards Subject: Automatic re-nicing of processes under 4.2 bsd Message-ID: <5849@brl-tgr.ARPA> Date: Fri, 16-Nov-84 19:10:31 EST Article-I.D.: brl-tgr.5849 Posted: Fri Nov 16 19:10:31 1984 Date-Received: Sat, 17-Nov-84 20:22:15 EST Sender: news@brl-tgr.ARPA Organization: Ballistic Research Lab Lines: 33 One of our users noticed that processes which accumulated a lot of CPU time under 4.2 bsd (for example, a Emacs which had been running on the same terminal for 3 days) would suddenly and seemingly arbitrarily get reniced. After a little bit of tracking, I found the following code in /sys/sys/kern_clock.c/softclock(): /* * 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; } What this does is to reduce the nice of any process 1) which is not be run by the superuser 2) whose nice is 0 3) which has accumulated more that 10 minutes of CPU time in its lifetime The nice of such a process is arbitrarily set to 4. This whole strategy seems totally bogus to me - it penalizes long-lived programs even if they're not CPU bound. Moreover, it seems unnecessary - there is already code in /sys/sys/kern_synch.c/schedcpu() (called by timeout once a second) to reduce the scheduling priority of CPU-bound processes and increase the scheduling priority of I/O-bound processes. Can this code be eliminated? Would there be any unexpected side-effects I haven't thought of? -Larry Allen