[221] in java-interest

home help back first fref pref prev next nref lref last post

Re: Threads vs New White Paper

daemon@ATHENA.MIT.EDU (Jonathan Payne)
Wed Jun 7 18:14:56 1995

Date: Wed, 7 Jun 1995 15:02:01 -0700
From: jpayne@flim@Sun.COM (Jonathan Payne)
To: johnm@medicus.com
Cc: java-interest@java.Eng.Sun.COM
In-Reply-To: <m0sJS0f-0008ZMC@medicus.medicus.com> (johnm@medicus.com)
Reply-To: jpayne@starwave.com

Java threads are preemptive in that if a threads a priority 5 is
currently running and then a thread at priority 6 wants to run, the
first thread is preempted.

But if you have two threads both at priority 5, then the one which is
running continues to run until it blocks, and then the other one gets
a chance.

On the other hand, the exact semantics do depend on the particular
implementation.  For instance, in green threads, which are what's used
on solaris, I believe the following is true:

	Thread A is running at priority 5
	Thread B wants to run at priority 5.
	Thread C wants to run at priority 6.
	Thread C starts running, and then blocks.
	Thread B starts running.

In other words, when a high priority thread preempts a lower one, then
that lower priority thread is moved to the end of the queue of threads
at that priority.

God knows what happens on the NT version.

> From: johnm@medicus.com (John Mitchell)
> Date: Wed, 7 Jun 95 13:47:28 PDT
> X-Mailer: ELM [version 2.3M PL11]
> Sender: owner-java-interest@java.sun.com
> Precedence: bulk
> X-Info: To unsubscribe, send 'unsubscribe' to java-interest-request@java.sun.com
> Content-Type: text
> Content-Length: 919
> 
> I have a printed copy of "The Java Language Environment" that was
> distributed at SunWorld '95.
> 
> In Chapter 4 "Interpreted, Dynamic, Secure, and Threaded", on page 45
> in the section "Java Supports Threads at the Language Level" the
> last paragraph states:
> 	Java's threads are pre-emptive.  If your applications are
> 	likely to be compute intensive, you might consider how to
> 	give up control periodically to give other threads a
> 	chance to run.  This will insure better interactive
> 	response for graphical applications.
> 
> So what's the deal?  Are threads in Java pre-emptive or not?  Or
> does it totally rely on the thread package built into Java on the
> runtime system?
> 
> Either way the white paper should be fixed and the documentation
> of the Thread class should be amended to make this clear.
> 
> Thanks,
> 	John
> -
> Note to Sun employees: this is an EXTERNAL mailing list!
> Info: send 'help' to java-interest-request@java.sun.com
> 
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post