Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 May 2001 16:24:38 +0100 (BST)
From:      Jan Grant <Jan.Grant@bristol.ac.uk>
To:        "David P. Caldwell" <inonit@inonit.com>
Cc:        freebsd-java <freebsd-java@freebsd.org>
Subject:   RE: Reading and writing audio data at the same time on Linux
Message-ID:  <Pine.GSO.4.31.0105041621220.28133-100000@mail.ilrt.bris.ac.uk>
In-Reply-To: <JIEPJODHFFPGJDGMCPBEIENCCDAA.inonit@inonit.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 4 May 2001, David P. Caldwell wrote:

> I'm not an expert on the linux JDK, but I ran into this sort of problem a
> few years back.
>
> Could it have to do with different scheduling?
>
> Since the Java VM specification doesn't say much about how threads have to
> work, implementors on Windows have tended to use timeslicing (which Windows
> has), while implementors on Unix-like OSes have tended to use preemptive
> (for different priorities) but non-timeslicing scheduling.
>
> On Unix-like OSes, usually a call to Thread.yield() is required periodically
> if you want other threads with equal priority to have a chance to run.
> Alternately, you can start a separate Thread at Thread.MAX_PRIORITY that
> just wakes up every specified number of milliseconds and does nothing,
> causing the scheduler to switch threads.

Actually, according to the java spec (as I've been led to understand it)
there is NO WAY to guarantee round-robin timesliced scheduling in java.

Why? Well, your suggestion above sounds plausible: have a high-priority
thread wake up occasionally and ensure that the right priority thread is
running. But Java says that thread priorities may be mapped onto a
smaller number of priority levels that the ohst OS provides, and says
nothing about how that mapping is performed. The result is that there
seems (to me, at least) to be NO portable way of ensuring that your
MAX_PRIORITY thread is _really_ running at any higher priorituy than any
other thread, so it may never wake up.

If this is wrong, I'd love to hear of a pointer to the bits in the spec
that I've misunderstood ...?

-- 
jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/
Tel +44(0)117 9287163 Fax +44 (0)117 9287112 RFC822 jan.grant@bris.ac.uk
stty intr ^m


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




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