From owner-freebsd-performance@FreeBSD.ORG Sun Sep 16 19:56:53 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 1768716A419 for ; Sun, 16 Sep 2007 19:56:53 +0000 (UTC) (envelope-from kip.macy@gmail.com) Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.187]) by mx1.freebsd.org (Postfix) with ESMTP id E75AF13C45E for ; Sun, 16 Sep 2007 19:56:52 +0000 (UTC) (envelope-from kip.macy@gmail.com) Received: by rv-out-0910.google.com with SMTP id l15so1040035rvb for ; Sun, 16 Sep 2007 12:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=B9UmwWyct4ImbUGW5xXk/HHlVLhZK+nTa7D7gvIFLC8=; b=gUOBUUT6CEGNbQVjJAZAjvgemfGoRm0oHsOALn+Pb5xcBnhmF4S5qEl101gcdCXU3JRnh3YoBdwbYIh8BIJm2ZGS9lktZ8byDcbqUp5DQQTcNPKHN3lrCcQknLzXktUZ4b1qpnN/xQTIGDxSU0ek4khkcaKfGB+oja8SLHv1B9g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ed2licbUprFB+nmEoj5JmlnlOd1eSYEAgZTrmbK2z5KAqcGb3TQl0i1T2qKmMeN892ju9vj+BN+nDG86zX4pfYyEK3qe2L3j4RA4IfeCujNrrCydQyETr2EKg+LY/tv3OBBZhP8gf/5wevDIYzpoKknWLiXOlIKJYSHVg6zQVWw= Received: by 10.114.37.1 with SMTP id k1mr1784793wak.1189972609701; Sun, 16 Sep 2007 12:56:49 -0700 (PDT) Received: by 10.114.13.15 with HTTP; Sun, 16 Sep 2007 12:56:49 -0700 (PDT) Message-ID: Date: Sun, 16 Sep 2007 12:56:49 -0700 From: "Kip Macy" To: "Daniel Eischen" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <46EC1B55.4060202@FreeBSD.org> <200709152250.50879.kurt@intricatesoftware.com> Cc: java@freebsd.org, Kris Kennaway , freebsd-java@freebsd.org, performance@freebsd.org, Kurt Miller 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: Sun, 16 Sep 2007 19:56:53 -0000 On 9/16/07, Daniel Eischen 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 peIrfect, 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. Yes, if we could hack the jvm to work around this without calling sleep that would be better yet. However, making java work well is more important than keeping the interface clean. > This test would fail even on Solaris if you use SCHED_RR or SCHED_FIFO > since it is POSIX compliant for those scheduling classes. I honestly don't think it matters. The JCK using it implies that there are probably java apps that rely on this defective behavior. I would be willing to bet that Solaris and Java developers at Sun already had this argument and the Java developers won :-(. -Kip