[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

difference between yield and join,wait and notify

Posted on 2012-09-09
5
Medium Priority
?
1,246 Views
Last Modified: 2012-09-11
could you please explain difference between yield and join,wait and notify in multithreading
0
Comment
  • 2
  • 2
5 Comments
 
LVL 9

Author Comment

by:Manikandan Thiagarajan
ID: 38380753
I am preparing for an interview i need to brush up my skills
0
 
LVL 34

Accepted Solution

by:
Michael-Best earned 2000 total points
ID: 38380776
(java-multithreading)

Yield simply temporarly stops to allow other threads to continue.
Join is used to join two threads together that are performing tasks at the same time.
A call to wait from within synchronized code causes the thread to give up its lock and go to sleep. This normally happens to allow another thread to obtain the lock and continue some processing. The wait method is meaningless without the use of notify or notifyAll which allows code that is waiting to be notified that it can wake up and continue executing.

Also see:
http://www.jchq.net/certkey/index.htm
0
 
LVL 12

Expert Comment

by:basav_com
ID: 38381129
0
 
LVL 9

Author Comment

by:Manikandan Thiagarajan
ID: 38381730
difference beween notify and noifyall
0
 
LVL 34

Expert Comment

by:Michael-Best
ID: 38381763
The difference between notify and notifyAll
Simply put, it depends on why your threads are waiting to be notified. Do you want to tell one of the waiting threads that something happened, or do you want to tell all of them at the same time
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month18 days, 5 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question