From owner-freebsd-questions Tue Mar 9 16:14: 6 1999 Delivered-To: freebsd-questions@freebsd.org Received: from WEBBSD1.turnaround.com.au (webbsd1.turnaround.com.au [203.39.138.49]) by hub.freebsd.org (Postfix) with ESMTP id DD37E14F8E for ; Tue, 9 Mar 1999 16:14:03 -0800 (PST) (envelope-from A_Johns@TurnAround.com.au) Received: from TurnAround.com.au (dhcp64.turnaround.com.au [192.168.1.64]) by WEBBSD1.turnaround.com.au (8.8.7/8.8.7) with ESMTP id LAA00437; Wed, 10 Mar 1999 11:16:07 +1100 (EST) (envelope-from A_Johns@TurnAround.com.au) Message-ID: <36E5B961.2D539114@TurnAround.com.au> Date: Wed, 10 Mar 1999 11:14:25 +1100 From: Andrew Johns Organization: TurnAround Solutions P/L X-Mailer: Mozilla 4.5 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 To: Thomas Schuerger Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Scheduling bug? References: <199903090923.KAA18794@wurzelausix.cs.uni-sb.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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