GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java
Go To First  |  Previous Question  |  Next Question 
 Core Java  |  Question 496 of 502    Print  
Inter Thread Communication
What are all the methods used for Inter Thread communication and what is the class in which these methods are defined?


  
Total Answers and Comments: 5 Last Update: August 25, 2009     Asked by: renijoym 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: sreedhar dantam
 
Inter thread communication is done using wait and notify (or notify all). These methods are defined in 'Object' class.

Above answer was rated as good by the following members:
uday bhasker reddy, Dilip Lodha, salil_sp, sushilkotnala, ahamza59, ashish_dhole30, subbu204655, minakshi sharma, jasjasan, sandeep549
December 15, 2008 00:17:21   #1  
maneesh.ce.2007 Member Since: November 2008   Contribution: 12    

RE: Inter Thread Communication
There are three ways in which Threads communicate with each other :

wait: It tells the calling thread to give up the monitor until some other thread enters the same monitor an calls Notify or Notifyall...

notify: It wakes up the first thread that called Wait() on the same object...

NotifyAll: It allows all the threads that called Wait() on the same object.The thread having the highest priority will run first...

 
Is this answer useful? Yes | NoAnswer is useful 5   Answer is not useful 0Overall Rating: +5    
December 19, 2008 09:28:28   #2  
bitwizard Member Since: December 2008   Contribution: 1    

RE: Inter Thread Communication
Thread

Thread.join() Thread.wait() Thread.interrupt() Thread.stop()

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 3Overall Rating: -3    
December 19, 2008 14:23:54   #3  
sreedhar dantam Member Since: December 2008   Contribution: 2    

RE: Inter Thread Communication
Inter thread communication is done using wait and notify (or notify all). These methods are defined in 'Object' class.
 
Is this answer useful? Yes | NoAnswer is useful 4   Answer is not useful 0Overall Rating: +4    
May 12, 2009 02:35:16   #4  
Radhakrishna P Member Since: May 2009   Contribution: 2    

RE: Inter Thread Communication
When Threads are executing on shared resources inorder to establish the communication among them the Object class providing some native methods like wait() notify() notifyAll().
 
Is this answer useful? Yes | NoAnswer is useful 3   Answer is not useful 0Overall Rating: +3    
August 25, 2009 08:34:55   #5  
satyanandr Member Since: August 2009   Contribution: 2    

RE: Inter Thread Communication
Two or more threads are communication via wait() notify() and notifyAll() method of an Object class.

wait(): method will lock the monitor of the thread to not process.

notify(): method will wake the thead which undergoes waiting state the wait state is waiting to called by notify or notifyAll()

notifyAll(): method will wake the theads which undergoes waiting state.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape