From owner-freebsd-java@FreeBSD.ORG Tue Sep 18 12:29:26 2007 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B85BD16A41A; Tue, 18 Sep 2007 12:29:26 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id 7682313C4EC; Tue, 18 Sep 2007 12:29:24 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.1/8.14.1/NETPLEX) with ESMTP id l8ICTCds007334; Tue, 18 Sep 2007 08:29:12 -0400 (EDT) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-3.0 (mail.netplex.net [204.213.176.10]); Tue, 18 Sep 2007 08:29:12 -0400 (EDT) Date: Tue, 18 Sep 2007 08:29:12 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Kurt Miller In-Reply-To: <200709180721.48995.kurt@intricatesoftware.com> Message-ID: References: <46EC1B55.4060202@FreeBSD.org> <46EDDCC9.90403@intricatesoftware.com> <200709180721.48995.kurt@intricatesoftware.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Content-ID: Content-Disposition: inline Cc: Kip Macy , Kris Kennaway , performance@freebsd.org, freebsd-java@freebsd.org Subject: Re: Massive performance loss from OS::sleep hack X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2007 12:29:26 -0000 On Tue, 18 Sep 2007, Kurt Miller wrote: > David Xu confirmed for me that pthread_yield() does give some > time to lower priority threads on 7.0 using thr. Attached and inline > are two patches for the 1.5 port that is how I suggest the issue be > addressed. I don't think you should rely on pthread_yield() doing that, it is dependent on the scheduler, and if you are running in SCHED_FIFO/SCHED_RR, it won't work with libthr either. Currently, you can only run in SCHED_FIFO or SCHED_RR as root using libthr, but that hopefully won't always be true. I think the way that will always work is to lower the priority and raise it back again after the yield, when using thread priorities. This should work for libthr, libc_r, and libkse under all versions of the OS. As for knobs, it would be nice to be able to turn off the default lowering and raising of priorities for Thread.yield() even when using thread priorities. Most likely, the only applications that relies on that behavior are the TCK tests themselves. I certainly wouldn't expect Thread.yield() to allow a lower priority thread to run. Are you allowed to supply knobs when running the TCK tests? Or does the JVM have to do the right thing by default? -- DE