java thread synchronization lock and mutex What is the difference?

Both include exclusive of resources.

The difference is

1: mutex is through the use of exclusive competition for resources, has nothing to do with each other, there is no fixed order of execution.

2: Synchronization is a thread owns the resources through a logical order, there is a certain relationship to complete the task.

Guess you like

Origin www.cnblogs.com/alan12138/p/11453736.html