From owner-freebsd-questions@FreeBSD.ORG Fri Feb 27 21:07:24 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 18F6616A4CE for ; Fri, 27 Feb 2004 21:07:24 -0800 (PST) Received: from mail27.cn4e.com (unknown [218.107.207.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id A726D43D1D for ; Fri, 27 Feb 2004 21:07:23 -0800 (PST) (envelope-from zhangweiwu@realss.com) Received: from realss.com (unknown [218.85.105.219]) by mail27.cn4e.com (WorldPost) with ESMTP id CDFA49E9C40E; Sat, 28 Feb 2004 13:29:49 +0800 (CST) Message-ID: <404021DB.6070009@realss.com> Date: Sat, 28 Feb 2004 13:06:35 +0800 From: Zhang Weiwu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040227 X-Accept-Language: zh-cn, en-us, en MIME-Version: 1.0 To: Erik Trulsson References: <20040228035629.GA66561@falcon.midgard.homeip.net> In-Reply-To: <20040228035629.GA66561@falcon.midgard.homeip.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 05:07:24 -0000 Erik Trulsson wrote: >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 don't understand. I watched top(1) for some time, it seems the mpg321 process, having NICE=-20, keep constant PRI of 108~110, but other processes like 'yacc', 'cc', although running at NICE=4, comes out even at PRI=120, and almost keep that high until it finish its work in several seconds and quit, meanwhile the speaker keep producing broken music. If NICE=-20 processes cannot have more PRI than NICE=4, what's the use of NICE? >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. > > My mpg123 hangs after copyright notice. It's another story though. >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.) > > I tried 'nice -n 19 make' which gives 'badly formed number' error. 'nice -19 make' made 'make' even greedy.