Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 18 Jun 2002 13:23:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 18 Jun 2002 13:23:58 -0400 Received: from perninha.conectiva.com.br ([200.250.58.156]:53257 "HELO perninha.conectiva.com.br") by vger.kernel.org with SMTP id ; Tue, 18 Jun 2002 13:23:56 -0400 Date: Tue, 18 Jun 2002 14:23:37 -0300 (BRT) From: Rik van Riel X-X-Sender: riel@duckman.distro.conectiva To: Chris Friesen Cc: David Schwartz , , , Subject: Re: Question about sched_yield() In-Reply-To: <3D0F669C.89596EC0@nortelnetworks.com> Message-ID: X-spambait: aardvark@kernelnewbies.org X-spammeplease: aardvark@nl.linux.org MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1199 Lines: 36 On Tue, 18 Jun 2002, Chris Friesen wrote: > > It has to. What if the only task running is: > > > > while(1) sched_yield(); > > > > What would you expect? > > If there is only the one task, then sure it's going to be 100% cpu on > that task. > > However, if there is anything else other than the idle task that wants > to run, then it should run until it exhausts its timeslice. > > One process looping on sched_yield() and another one doing calculations > should result in almost the entire system being devoted to calculations. So if you have a database with 20 threads yielding to each other each time a lock is contended and one CPU hog the database should be reduced to a very small percentage of the CPU ? regards, Rik -- http://www.linuxsymposium.org/2002/ "You're one of those condescending OLS attendants" "Here's a nickle kid. Go buy yourself a real t-shirt" http://www.surriel.com/ http://distro.conectiva.com/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/