On Concurrent Programming in Java

1 Concurrent keywords

1.1 synchronized

1.1.1 The role of synchronized?

The synchronized keyword is used to control thread synchronization and avoid thread safety issues in a concurrent environment.

1.1.2 The use of synchronized?

Modify the instance method and lock the instance object.
Modify static methods and lock the class object.
Decorate the code block and lock the specified object.

1.1.3 The underlying realization principle of synchronized?

Guess you like

Origin blog.csdn.net/shiquan202101/article/details/112297627