From owner-freebsd-performance@FreeBSD.ORG Mon Sep 17 01:16:25 2007 Return-Path: Delivered-To: performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7D1516A417; Mon, 17 Sep 2007 01:16:25 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id A382E13C467; Mon, 17 Sep 2007 01:16:25 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 1985B1A4D7C; Sun, 16 Sep 2007 17:59:12 -0700 (PDT) Date: Sun, 16 Sep 2007 17:59:12 -0700 From: Alfred Perlstein To: Daniel Eischen Message-ID: <20070917005912.GT79417@elvis.mu.org> References: <46EC1B55.4060202@FreeBSD.org> <200709152250.50879.kurt@intricatesoftware.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: performance@freebsd.org, Kip Macy , Kris Kennaway , java@freebsd.org, Kurt Miller , freebsd-java@freebsd.org Subject: Re: Massive performance loss from OS::sleep hack X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Sep 2007 01:16:26 -0000 * Daniel Eischen [070916 08:46] wrote: > On Sat, 15 Sep 2007, Kip Macy wrote: > > >Or more likely they'll continue to maintain a sched_yield that isn't > >posix compliant. We may just want to add some sort of interface so the > >jvm can tell the kernel that sched_yield should be non-compliant for > >the current process. > > I don't think that is a good idea, it seems like too much of a hack. > The scheduler(s) should schedule threads the way they are designed > to, either obeying a threads priority, using it as a hint, or totally > ignoring it. > > If the JVM kept track of the thread priorities in use, I suppose > Thread.yield() could first lower the current thread's priority to > the next used priority and then yield, raising the priority back after > the yield. This isn't perfect, there are race conditions, the next > highest priority thread(s) could be blocked and not runnable, etc. > Maybe just lowering the priority to min or default priority would work > well enough. > > This test would fail even on Solaris if you use SCHED_RR or SCHED_FIFO > since it is POSIX compliant for those scheduling classes. Since Sun wasn't concenred with correctness, just performance, I don't think we have to shoot for the moon here. I think your suggestion about temporarily lowering priority makes sense. -Alfred