Search:     Advanced search
Browse by category:
C/C++   |   Java   |   Oracle/Database   |   SAP   |   ASP .NET   |   Mainframe-DB2   |   Freshers

What do you understand by Synchronization?

Add comment
Views: 403
Votes: 1
Comments: 0
Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modify a shared object while another thread is in the process of using or updating the object's value.
Synchronization prevents such type of data corruption.
E.g. Synchronizing a function:
public synchronized void Method1 () {
// Appropriate method-related code.
}
E.g. Synchronizing a block of code inside a function:
public myFunction (){
synchronized (this) {
// Synchronized code here.
}
}
Others in this Category
document Q: How can a subclass call a method or a constructor defined in a superclass?
document How can I call one EJB from inside of another EJB?
document Difference between Swing and Awt?
document How can I enable session tracking for JSP pages if the browser has disabled cookies?
document What is the difference between the size and capacity of a Vector?
document Code to get all the URL in a page
document What is the List interface?
document What is daemon thread and which method is used to create the daemon thread?
document What is Action Class?
document How could Java classes direct program messages to the system console, but error messages, say to a file?
» More articles



RSS