Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Sep 2007 08:29:12 -0400 (EDT)
From:      Daniel Eischen <deischen@freebsd.org>
To:        Kurt Miller <kurt@intricatesoftware.com>
Cc:        Kip Macy <kip.macy@gmail.com>, Kris Kennaway <kris@freebsd.org>, performance@freebsd.org, freebsd-java@freebsd.org
Subject:   Re: Massive performance loss from OS::sleep hack
Message-ID:  <Pine.GSO.4.64.0709180822080.15581@sea.ntplx.net>
In-Reply-To: <200709180721.48995.kurt@intricatesoftware.com>
References:  <46EC1B55.4060202@FreeBSD.org> <b1fa29170709161256n25bdb7d8q8aa2f1b263c18e48@mail.gmail.com> <46EDDCC9.90403@intricatesoftware.com> <200709180721.48995.kurt@intricatesoftware.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.64.0709180822080.15581>