From owner-freebsd-questions@FreeBSD.ORG Fri Feb 27 19:56:34 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3673F16A4CE for ; Fri, 27 Feb 2004 19:56:34 -0800 (PST) Received: from falcon.midgard.homeip.net (h201n1fls24o1048.bredband.comhem.se [212.181.162.201]) by mx1.FreeBSD.org (Postfix) with SMTP id 968AE43D1D for ; Fri, 27 Feb 2004 19:56:32 -0800 (PST) (envelope-from ertr1013@student.uu.se) Received: (qmail 70026 invoked by uid 1001); 28 Feb 2004 03:56:30 -0000 Date: Sat, 28 Feb 2004 04:56:30 +0100 From: Erik Trulsson To: zhangweiwu@realss.com Message-ID: <20040228035629.GA66561@falcon.midgard.homeip.net> Mail-Followup-To: zhangweiwu@realss.com, questions@freebsd.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i cc: questions@freebsd.org Subject: Re: scheduling priority not working? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Feb 2004 03:56:34 -0000 On Sat, Feb 28, 2004 at 11:37:51AM +0800, Zhang Weiwu wrote: > Hello. I thought scheduling priority is the kind of absolute priority, that > is only when the higher priority process don't ask for resource, can the > lower priority process gets resource. If the higher priority process sucks, > the lower priority process starvs. > > Now I have a old Pentium-mmx 166 box, running mpg321 fine. I wish to listen > to music when recompile the kernel, so turn on the music, do: > #nice make; > I thought "nice make" use the resouce mpg321 left to it, but actually the > music process is seriously disturbed, it begins to sound like .... > terrible. > > So I don't realy understand the scheduling priority mechnism in FreeBSD? No, you dont quite understand the scheduling. There are actually two different priorities that influence scheduling. If you look at the output from top(1) you can see them in the columns labeled 'PRI' and 'NICE'. The first one ('PRI') is the one that is actually used to determine when a process gets to run. This is dynamically adjusted by the system to make sure that all processes get at least *some* CPU-time (so no process can be completely starved.) The second ('NICE') is what is changed by the nice/renice commands and affects how the actual priority is changed by the system. (Processes with a high nice-value essentially gets their priority raised slowly and lowered quickly .) I run at a very similar box, but use mpg123 rather than mpg321, and I can play music without significant disturbance. You might wish to try mpg123 instead, in my experience it needs less CPU-power than mpg321. You could also try using a higher nice value for the make process. (i.e run it with 'nice -19 make' or something like that.) -- Erik Trulsson ertr1013@student.uu.se