• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread doubt ???  RSS feed

 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

1>Suppose JVM implentation is non-preemptive? does Thread priority and methods such as yield matter there?
 
sarvesh meens
Ranch Hand
Posts: 43
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thread-priority and yield() matter a lot under collaborative scheduling(non-preemptive).
In collaborative scheduling each thread occupies CPU as long as it wants to. Only when the thread that is running yields or dies other threads get a chance to occupy CPU.
Thread-priority is one of the important criteria that JVM uses to choose the thread that is to be given run state.


It should be noted that JVM's scheduling strategy matters only for green threads.
Native threads are scheduled directly by the kernal.
Green-threads have long been abandoned.
Thesedays,all threads spawned in java are native threads.
JVM's scheduling strategy doesnt really matter a lot to native threads.

But thread-priority and yield() do affect the way in which native threads are scheduled as well.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!