1.

What Is Synchronization In Java?

Answer»

The process of monitoring the access to shared resources by multiple threads so that only one thread can access one resource at time is known as synchronization. Synchronization is used to avoid DATA consistency and corruption problems and also to prevent any KIND of thread interference.

Java PROVIDES a special keyword known as “synchronized” which can be used either for synchronizing a block of code or for synchronizing a METHOD.

  1. The keyword “synchronized” can be used a part of the method declaration.
  2. Or a block of code can be placed in synchronized keyword using ‘this’ java operator.

The process of monitoring the access to shared resources by multiple threads so that only one thread can access one resource at time is known as synchronization. Synchronization is used to avoid data consistency and corruption problems and also to prevent any kind of thread interference.

Java provides a special keyword known as “synchronized” which can be used either for synchronizing a block of code or for synchronizing a method.



Discussion

No Comment Found