java virtual machine thread-safe implementations:
A blocking synchronization (sync mutual exclusion)
1.synchronized is such a synchronized manner.
2. The main problem is that the process of blocking and wake caused by performance issues.
3. It is a pessimistic concurrency strategy, regardless of whether there really competition to share data, should be locked.
Two non-blocking synchronization
1. It is based on optimistic concurrency strategy collision detection. First carry out the first operation, if there is no contention on the successful, if there is contention, the conflict, and then take other compensation measures.