What is the difference between yielding and sleeping?

What is the difference between yielding and sleeping?

YieldingSleeping
Yield will causes the thread to rejoin the queue.Sleep holds the thread's execution for the specified time.
When a task is invoked in yielding, it returns to the ready state.When a task is invoked in sleeping, it returns to the waiting state.
It is used to get the running thread into out of runnable state with the same priority.It is used to delay the execution for a period of time.
What is a task's priority and how is it used in scheduling?
What is a task's priority and how is it used in scheduling? - A scheduler uses the priorities of a task to determine its execution. Priorities can be high or low determined.....
Can we have parameterized constructors in Java?
Can we have parameterized constructors in Java? - Yes, we can have. This is also called as constructor overloading.....
JSP Interview Questions and Answers - Freshers & Experienced!
JSP interview questions with answers for freshers and experienced, JSP interview FAQ - In this series, we have covered all about JSP and answered the questions that might be asked during an interview.
Post your comment