Answer Posted / rajani nagandla
With respect to multithreading, 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 a particular 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 which
may otherwise lead to dirty reads and significant errors.
E.g. synchronizing a function:
public synchronized void Method1 () {
// method code.
}
E.g. synchronizing a block of code inside a function:
public Method2 (){
synchronized (this) {
// synchronized code here.
}
}
| Is This Answer Correct ? | 10 Yes | 3 No |
Post New Answer View All Answers
Name component subclasses that support painting in java programming?
Explain about the performance aspects of core java?
Is it necessary that each try block must be followed by a catch block?
Is java good for beginners?
Can the interface be final?
Can we return null in java?
Convert a BST into a DLL and DLL to BST in place.
What is a lambda expression ? What's its use ?
How to disable caching on back button of the browser?
How is garbage collection controlled?
What is abstraction in java?
Why string is not a wrapper class?
According to java operator precedence, which operator is considered to be with highest precedence?
How many bits is a string?
How do you sort words in java?