Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

thread priority

 
Yi Meng
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
with reference to Dan's Thread exam 1 Q17
t1.setPriority(Thread.MIN_PRIORITY);
t2.setPriority(Thread.MAX_PRIORITY);
The answer given is "a.The priority assigned to thread T2 is greater than the priority assigned to T1.".
But to some single priority operating system all the threads will actually be the same priority.....and thus the answer should be "d. None of the above.". is it true? any comments?
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The complete question is as follows.

Answer a.
The explanation is as follows.

The Java Language Specification suggests that higher priority threads should be given preference over lower priority threads but explicitly states that such preference is not a guarantee. It is very important to remember that no guarantee exists.

It is correct to say that the operating system is free to ignore the priority levels assigned to the Threads.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic