Subject: Nice 20 process running despite needed CPU time
To: NetBSD current-users <current-users@NetBSD.org>
From: Bjoern Labitzke <hermit@hermit.home.cs.tu-berlin.de>
List: current-users
Date: 05/02/2000 01:57:24
Hello...

Quite some time ago the scheduler got changed so that processes, that got
a nice value of 20 assigned, weren't run when processes with nice values <=0
needed the CPU. Well, finally I became aware of the fact that this does not
always work. 

Assuming there are only processes with nice values of zero or less that use
the full CPU time. When I run a process with nice level 20 now, it gets
started and then does not get any more CPU cycles until the other processes
don't use them all.

Assuming the same setup. Now I start a process with a nice value 1<=val<=18.
It gets some CPU cycles like it is expected to get, but leaves the majority
for the other tasks. But when I now start a process (or renice it) with a
nice value of 20, that task suddenly _gets_ CPU cycles, though the processes
with values <=0 would need them all!

(The example, where I spotted this first: Running lame with nice 0, the
distributed.net client with 20 and a cvs update with 10. Without the cvs 
process the distributed.net client doesn't get any cycles, because lame takes
them all. With cvs at level 10, it gets 10-20% of the CPU time!)


To summarize: Processes with a nice value of 20 don't get CPU cycles, if 
processes with values <=0 need them, _unless_ one or more processes with a
value between 1 and 18 are using cycles as well.

It seems to me, that this behaviour is not correct. If it is the intended
behaviour, the setpriority man page should be changed appropriatly. Or do I
miss something?

Bye,
Bjoern

-- 
Bjoern Labitzke  <hermit@cs.tu-berlin.de>
   Use PGP! (Don't you use envelopes for your letters?)