SCJP Certification

Sun Certified Java Programmer Certification exam essentials

September 30th, 2009

What is a thread priority?

Uncategorized, by Daisy Williams.

Thread priorities are used by the scheduler to send a thread into the runnable state or the running state. The thread priorities are defined as static final variables within Thread. The higher priority threads are executed in preference to threads with lower priority.

When code running in some thread creates a new Thread object, the new thread has its priority initially set equal to the priority of the creating thread. The Thread class uses the following three constants to define the range of thread priorities:

  1. Thread.MIN_PRIORITY (1): Returns a thread to priority 1.
  2. Thread.NORM_PRIORITY (5): Returns a thread to priority 5.
  3. Thread.MAX_PRIORITY (10): Returns a thread to priority 10.
Share

Back Top

Responses to “What is a thread priority?”

Comments (0) Trackbacks (0) Leave a comment Trackback url
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

*