How to define thread priority?

Thread Priorities:

  • Every Java thread has a priority that helps the operating system determine the order in which threads are scheduled.
  • Java priorities are in the range between MIN_PRIORITY (a constant of 1) and MAX_PRIORITY (a constant of 10). By default, every thread is given priority NORM_PRIORITY (a constant of 5).
  • Threads with higher priority are more important to a program and should be allocated processor time before lower-priority threads. However, thread priorities cannot guarantee the order in which threads execute and very much platform dependent.

Leave a Reply

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