From owner-freebsd-threads@FreeBSD.ORG Mon Jul 7 15:53:37 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F14D637B404 for ; Mon, 7 Jul 2003 15:53:36 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 01C1243FAF for ; Mon, 7 Jul 2003 15:53:36 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.8/8.12.1) with ESMTP id h67MrYAI017592; Mon, 7 Jul 2003 18:53:35 -0400 (EDT) Date: Mon, 7 Jul 2003 18:53:34 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Petri Helenius In-Reply-To: <010501c344cf$f66be110$812a40c1@PETEX31> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE cc: freebsd-threads@freebsd.org Subject: Re: thread scheduling priority X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: deischen@freebsd.org List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 22:53:37 -0000 On Tue, 8 Jul 2003, Petri Helenius wrote: > > > So when the main thread unlocks the mutex there are two runnable thre= ads, > > > which one keeps running? > > > > The current thread. As I said before, if there are idle KSEs, then > > one is woken to run the newly runnable thread. > > > Although I cannot prove this doesn=B4t happen, I think the other > thread does not get scheduled until a few moments later because > when I get the scenario where thread1 has the mutex, thread2 > is waiting on it, thread1 goes to cpu-bound tasks without > holding the mutex, thread2 is not woken up, at least not immediately. The KSE is woken immediately, but you are at the whimsy of the kernel scheduler. Depending on what else is running, the woken KSE may not run right away. You can see the wakeups using ktrace... --=20 Dan Eischen