In case anyone is interested, there is a useful description of such issues
in the O'Reilly book "Java Threads", chapter 6 "Java Thread Scheduling",
which discusses some popular scheduling implementations.

A couple of suggestions (not tested):

If you don't want to use MIN priority, you may be able to choose a priority
between MIN and NORM, if this is supported on your target system(s).
Unfortunately, although there are many different priorities in the JVM,
these may not all map onto different priorities in a real implementation.
[Indeed, even MIN and NORM may end up with effectively the same priority,
depending on the implementation.]

Yield() does not guarantee that another thread will execute; it may be that
the next eligible thread is the one that is yielding. But if you can
sprinkle more yield() calls around your code you may get what you want...

-- 
Sebastian Bazley <[EMAIL PROTECTED]>
The opinions expressed herein are my own, and are not necessarily endorsed
by my employer ...

> -----Original Message-----
> From: Alexander V. Konstantinou [mailto:[EMAIL PROTECTED]]
> Sent: 20 July 1999 21:36
> To: Thomas M. Sasala
> Cc: Java Mailing List
> Subject: Re: [Fwd: [Fwd: [Fwd: Swing Priority]]]
> 
> 
> If you read the JVM threading specification, it explicitely 
> states that
> threads of the same priority are *NOT* guaranteed to be time-sliced.
> This is the most common cause of incompatibilities, as software that
> works on MS WinNT (has time-slicing), breaks on other 
> operating systems
> without time-slicing.  The solution is to have the busy thread execute
> with a lower priority.
> 
> Alexander
> 
> On Tue, Jul 20, 1999 at 02:24:28PM -0400, Thomas M. Sasala wrote:
> >     It's not really a problem, unless the main app does something
> > in an event that takes a while.  Since I am currently the only one
> > using the app, it's not an issue.  However, in the future, it
> > might become an issue.
> > 
> >     Generally I was hoping to set the thread to the same
> > priority as the event handler and let the OS take care of
> > time slicing.  Clearly the JVM is not that robust though.
> > 
> > "Robert A. Crawford" wrote:
> > > 
> > > On Tue, Jul 20, 1999 at 12:32:19PM -0400, Thomas M. Sasala wrote:
> > > >       Setting my task to MIN_PRIORITY fixes the problem, but
> > > > I think it is a suboptimal fix.  So:
> > > 
> > >         Why is that a problem? The event thread probably spends
> > > 95% of its time waiting for events, so your thread would get
> > > the time it needs.
> 
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact 
> [EMAIL PROTECTED]
> 


___________________________________________________________________________
This email is confidential and intended solely for the use of the 
individual to whom it is addressed. Any views or opinions presented are 
solely those of the author and do not necessarily represent those of 
Sema Group. 
If you are not the intended recipient, be advised that you have received this
email in error and that any use, dissemination, forwarding, printing, or 
copying of this email is strictly prohibited.

If you have received this email in error please notify the Sema Group
Helpdesk by telephone on +44 (0) 121 627 5600.
___________________________________________________________________________

application/ms-tnef

Reply via email to