What is yielding and sleeping? how they different?

Answer Posted / ranganathkini

When a thread yields, its execution is paused and loses
ownership of the monitor lock giving other waiting threads a
chance to run.

When a thread sleeps, its execution is paused for the
specified duration during such an idle period, the thread
continues to retain the ownership of the monitor lock.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data type example?

648


Can we execute java program without main method?

601


What is continuity of a function?

613


What is the function of http?

630


What is stack example?

647






How dead lock situation occurs in java and how you can identify it?

633


what is meant by Byte code concept in Java?

674


What is the difference between java applets and applications?

676


Hi Anyone know the model / questions of the Federal bank sample questions for the post of Specialist Officers - Programmers. Please post if anyone have..

1924


how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread

615


I want my class to be developed in such a way that no other class (even derived class) can create its objects. Define how can I do so?

785


What does int argc char * argv [] mean?

618


What is compiler and what its output.

724


Why are arrays useful in java?

634


How to display arraylist values in java?

578