Java Multi-Threading Question:
Download Job Interview Questions and Answers PDF
Explain the difference between yielding and sleeping?
Answer:
Sleep causes the currently executing thread to sleep until the specified time is completed. The thread will resume once the specified time period is over.
Sleep causes the currently executing thread to sleep and gives a chance to other threads to execute. The thread will join the ready queue.
Thread.sleep() will moves the thread to “Wait” state.
Thread.yield() will moves the thread to “Ready” state.
Sleep causes the currently executing thread to sleep and gives a chance to other threads to execute. The thread will join the ready queue.
Thread.sleep() will moves the thread to “Wait” state.
Thread.yield() will moves the thread to “Ready” state.
Download Java Multi-Threading Interview Questions And Answers
PDF
Previous Question | Next Question |
What the difference is between notify and notify All methods? | Explain the difference between preemptive scheduling and time slicing? |