GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 5 of 923    Print  
What is synchronization and why is it important
With respect to multithreading, synchronization is the capability to control the access ofmultiple threads to shared resources. Without synchronization, it is possible for onethread to modify a shared object while another thread is in the process of using orupdating that object's value. This often leads to significant errors.


  
Total Answers and Comments: 7 Last Update: November 08, 2007   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: ravikant
 
Well Synchronization is the way to make our program safe. It is used in multithreading. As we know when we have two or more threads that share a common code there can be some problem like inconsistent of data if one thread is updating data in that code. so if we make that sharable code(common code) synchronized then its  ensured that at a given time only one thread will be having rights to access that code. other threads can't  access the code untill its free that is not being used by other thread. hope your point is clear now.

Above answer was rated as good by the following members:
Lokesh M, freeman76
July 26, 2005 03:37:25   #1  
javid        

RE: What is synchronization and why is it important
can u give me more information on syncronization and deadlocks and the practical usage of that.
 
Is this answer useful? Yes | No
August 27, 2005 03:54:41   #2  
RANJEET KUMAR RAVI        

RE: What is synchronization and why is it important
threads share monitor(critical section) and only one thread can have monitor at a time.hence synchronization is important so that no other thread  
attemp to hold the monitor.

 
Is this answer useful? Yes | No
September 14, 2005 02:14:21   #3  
ravikant        

RE: What is synchronization and why is it important
Well Synchronization is the way to make our program safe. It is used in multithreading. As we know when we have two or more threads that share a common code there can be some problem like inconsistent of data if one thread is updating data in that code. so if we make that sharable code(common code) synchronized then its  ensured that at a given time only one thread will be having rights to access that code. other threads can't  access the code untill its free that is not being used by other thread. hope your point is clear now.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
September 29, 2005 06:31:59   #4  
Anu Patreddy        

RE: What is synchronization and why is it important
Synchronization is a process of letting one thread to access the method while all other thread are waiting, which avoids deadlock.
 
Is this answer useful? Yes | No
November 09, 2005 05:04:29   #5  
Devidas Sonawane        

RE: What is synchronization and why is it important
Synchronization is the safe mechanism for memory leakage problem. In which we can modify one thread to complete another thread's process and then executes other. 
 
Is this answer useful? Yes | No
September 13, 2007 05:31:29   #6  
priya        

RE: What is synchronization and why is it important
Synchronisation is a phenomenon in multithreaded programming which enforce synchronicity when we need it. For eg, if we want two threads to share a complicated datastructure we need to ensure that they dont conflict with each other. That is we must prevent one thread from writing data while the other is in the middle of reading it. For this process, Java uses the concept of monitor. The monitor is a control mechanism and it is like a small box that can hold only one thread. Once a thread enters the monitor, all other threads must wait until it remains in that box (monitor). In Java each object has its own implicit monitor that is entered when the object's synchronised method is called. Once a thread is inside a synchronised method, no other thread can call any other synchronised method on the same object.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
November 08, 2007 09:01:58   #7  
bijuleo Member Since: September 2005   Contribution: 2    

RE: What is synchronization and why is it important

Synchronization is the mechanism that ensures that only one thread is accessed the resources at a time. In a practical point of view assume that two threads are trying to update bank balance at the same time!!! How we can solve this issue the answer is sychronization. Hope you got the importance


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape