• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threading - Default priority

 
Thomas De Vos
stable boy
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JDK docs 1.4.2 does not mention anymore the default priority as 5, this has been removed.
Previous Javadocs did contain as NORM priority the value of 5. However when you create a Thread the getPriority() returns 5. The priority is actually assigned from the parent priority (i.e. the creating Thread), and it is the scheduler that will decide which Thread to run.
I'm wondering if something has been changed to the implementation!?
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API still refers to NORM_PRIORITY: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Thread.html
 
Thomas De Vos
stable boy
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed but it does not mention anymore that the default priority is 5.
 
Thomas De Vos
stable boy
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only if you look to the actual values.
Still wondering what has been changed.
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
It proabably doesn't refers to 5 because some implementations of java may have a different NORM_PRIORITY. Say 3 or something else.
[ May 27, 2003: Message edited by: Anupam Sinha ]
 
Thomas De Vos
stable boy
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The book from Kathy and Bert does mention that the default priority is 5. Sybex book mentions also that the defualt priority is 5.
I'm aware that the actual implementation can change and that the OS threading mechanism needs mapping to the actual values implemented by the JVM, but the Java language definition default priority is 5.
Conclusion: The values of the Java implementation are not one to one mapped to the JVM's implementation.
I believe that for the exam the default priority is 5, that is what the actual Java implementation is.
Any comments ...
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thomas
5 is not the default priority. But 5 can be the default priority. That is, if the parent thread has a priority of 5. Secondly there might be a java compiler lets say from XYZ that doesn't uses the NORM_PRIORITY as 5 but likes it to be 3. XYZ may choose to this because they might be having the priorities in the range of MAX_PRIORITY(1) to MIN_PRIORITY(7). So this might be a reason that java refers to the constant NORM_PRIORITY.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic