1 Answers

Rahul Roi
Rahul Roi

A Synchronization is the technique that allows only one thread to access the resource for a particular time. None other thread can interrupt until the assigned thread finishes its task.

Into a multithreading program, the threads are allowed to access any resource for the required execution time. These threads share resources and execute asynchronously. And accessing shared resources (data) is a critical task that sometimes may halt the system. We deal with it by making threads synchronized.

This is mainly used in case of transactions like deposit, withdrawal, etc.