Critical Resources
In multi-threaded process, there may be a case of multiple threads access the same shared variable resources simultaneously. This resource may be variable, file, object and so on.
Share : resources can be accessed simultaneously by multiple threads
Variable : Resources can be modified during its life cycle
Problems caused by:
Since the process thread is not controllable, so the need to use synchronization mechanisms to access the variable state of collaborative objects.
Locking purpose
Serialize access to critical resources : that at any one time, only one thread access to critical resources, also known as synchronous exclusive access .
JAVA lock system
JAVA thread of life status