From owner-freebsd-java@FreeBSD.ORG Sun Sep 16 05:53:53 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 9BC2516A469 for ; Sun, 16 Sep 2007 05:53:53 +0000 (UTC) (envelope-from kip.macy@gmail.com) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.190]) by mx1.freebsd.org (Postfix) with ESMTP id 09D3113C45E for ; Sun, 16 Sep 2007 05:53:52 +0000 (UTC) (envelope-from kip.macy@gmail.com) Received: by mu-out-0910.google.com with SMTP id w9so1519245mue for ; Sat, 15 Sep 2007 22:53: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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=KtLsE7RsPnk1Mrbhw0byorqWWv0pa1bpf5Ur7lJEo5A=; b=I3Zz1Z2vFyahlMUV6TDFaSDV9d6+GEHsCBtokIWpVdk4EbTTeYMU75gs0g2XKplzTIlKgvjrsnbpvuUMdjGw6GCQPd5dhu/NBu9kJmxI8qv49z+tKrgeiwBcyeo6cZUKQRI36/T8bcP2LHZtwwgdbWXGgYYcXMuB552XdJ1tz8Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=tZT7wIo31d6mX5GONdxJGuoMBYr6Xvt3bbHJw9gAYgxR1KJReW6HmKVQQDyx/IcSVt1QHe8rIR3XoxTKQXxZzeeRgjNfy4Amv6F6njJEBJh0AA1XBavwuYAMspso3PklZT9o1CyL2I9n4gBr184Bp5R9ECSvSazS9dCqtS16eqA= Received: by 10.78.132.2 with SMTP id f2mr1890799hud.1189920329524; Sat, 15 Sep 2007 22:25:29 -0700 (PDT) Received: by 10.78.162.18 with HTTP; Sat, 15 Sep 2007 22:25:29 -0700 (PDT) Message-ID: Date: Sat, 15 Sep 2007 22:25:29 -0700 From: "Kip Macy" To: "Daniel Eischen" , "Kurt Miller" , java@freebsd.org, "Kris Kennaway" , performance@freebsd.org, freebsd-java@freebsd.org 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: Subject: Re: Massive performance loss from OS::sleep hack X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Sep 2007 05:53:53 -0000 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. On 9/15/07, Daniel Eischen wrote: > On Sat, 15 Sep 2007, Kurt Miller wrote: > > > > Hello Kris, > > > > I recall why I added the os_sleep() call. While working on the > certification > > testing one of the JCK tests was deadlocking. The test itself was faulty > in > > that it created a high priority thread in a tight yield loop. Since > > pthread_yield() on a single processor system will not yield to lower > > priority threads, the higher priority thread effectively blocked the > > lower priority thread from running and the test deadlocked. > > > > I filed a formal appeal to have the JCK test corrected. However since the > > api states: > > > > http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html#yield() > > "Causes the currently executing thread object to temporarily pause > > and allow other threads to execute." > > > > the appeal was denied. I further argued that many publications written > > by or or-authored by Sun employees state that Thread.yield() can not > > be relied upon in this fashion: > > [ ... ] > > It's odd that Sun would take this position since the POSIX behavior > for sched_yield() is: > > The sched_yield() function shall force the running thread to > relinquish the processor until it again becomes the head of its > thread list. It takes no arguments. > > The "its thread list" mentioned above is the list of threads for its > given priority. POSIX has a notion of a list of threads for each > given priority; in SCHED_RR and SCHED_FIFO scheduling the higher > priority threads will always run before lower priority threads. > > Sun's defined Java behavior, or their interpretation, of Thread.yield() > is not obtainable on a POSIX compliant system using sched_yield() > (or pthread_yield()). Even using scope system threads or libthr, > the kernel scheduler should run the higher priority threads before > lower priority threads. > > I suspect that Sun will eventually be forced to change their > documented behavior for Thread.yield(). > > -- > DE > _______________________________________________ > freebsd-performance@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-performance > To unsubscribe, send any mail to > "freebsd-performance-unsubscribe@freebsd.org" >