Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Mar 1999 11:14:25 +1100
From:      Andrew Johns <A_Johns@TurnAround.com.au>
To:        Thomas Schuerger <schuerge@wurzelausix.CS.Uni-SB.DE>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Scheduling bug?
Message-ID:  <36E5B961.2D539114@TurnAround.com.au>
References:  <199903090923.KAA18794@wurzelausix.cs.uni-sb.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Thomas Schuerger wrote:
> 
> Hi!
> 
> I am not really satisfied with the scheduling (time-slicing) used in FreeBSD,
> regarding the nice-levels of processes.
> 
> When having two processes running, one with nice-level 0, the other one with
> nice-level 19 and both consuming as much CPU time as possible (e.g. an endless
> loop), FreeBSD will do a 2:1 time-slicing (that is, the first process will get
> 66% of the CPU-time and the other one 33%). For a test, just start two Perl
> processes doing a "while(1) {}", renice one of the processes to 19 and watch
> the "top" output.
> 
> This behaviour is rather strange. It means that if having a long-running process
> in the background (nice-level 19), any CPU-intensive foreground process will run
> with at most 2/3 of the possible speed.
> 
> I have tried the same on Linux, which gives the second process about 9% of the
> CPU-time and therefore resulting in a 10:1 slicing, which I find much more
> promising. Solaris resulted in a 7:1 time-slicing.
> 
> Is there anything that can be done to make renicing a process to high values
> more effective? I would like to see the slicing factors drop off e.g.
> exponentially with the nice-level used, so that renicing to 19 has a huge effect and
> really makes such processes run in the background, giving a lot more CPU-time to
> foreground processes if needed.
> 
> Is there a kernel option that affects this?
> 
> Ciao,
> Thomas.
> 
> P.S.: I'm using FreeBSD 4.0-Current, but it was the same on 3.0-Release.
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

Surely, as a lower priority process cannot preempt a higher
priority process, then the ratio that you refer to is simply the
result of the process with the higher priority _allowing_ itself
to be preempted by not requiring processor time hence what you're
really seeing is a more efficient use of the processor sharing
itself between 2 cpu-intensive tasks.

It's impossible given the test that you created to accurately
_measure_ this difference, as you're relying on an interpreted
(perl) loop - I'd be interested to see the same results with an
executable that was looping - so as to remove the layer of the
interpreter.

Failing that, of course you can always adjust the priorities of
the processes by other means - change your own code, give extra
priority to the foreground process, etc.
-- 
Regards                        |    _/\_/\
Andrew Johns BSc (Comp Sci)    |   /      \
TurnAround Solutions Pty Ltd   |   \_...__/
http://www.turnaround.com.au/  |        \/

"The box said 'Requires Windows 95, NT, or better,' so I
installed FreeBSD."


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36E5B961.2D539114>