Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JVM, Thread.yield(), and Time-slicing...?

843811Aug 10 2001 — edited Aug 10 2001
I'm using a multi-process OS (Sun-os) that makes use of process scheduling and time-slicing, etc.... (I know... who isn't!?...)

My question is:

Does a call to Thread.yield() yield to only other JVM-managed threads, or to all processes that the OS is managing?

In other words, when a call is made to Thread.yield() does this thread yield to the JVM, or to the OS?

For example, if I have a program existing of one thread and it's job is to look for the existance of a particular file. If the file exists, then process it, but if it does not then it yields before it looks for the file again. Assuming that this thread is the only JAVA thread running, does the JVM give up the rest of its timeslice allotted by the OS so that the OS's scheduler can let other applications (perhaps not java/jvm related apps) have a chance to run? Or, does it use up the rest of it's time slice regardless of the yield.

-Craig
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 7 2001
Added on Aug 10 2001
3 comments
579 views