First, the lock fair / unfair lock / reentrant lock / recursive lock / spin locks talk about your understanding
Fair locks: multiple threads in order to apply to acquire the lock.
Unfair lock: lock the application has nothing to do with the order of the order of multiple threads to acquire a lock. [ReentrantLock default unfair, synchronized]
Summary: Unfair lock throughput is greater than the fair locks.
Reentrant lock (also known as recursive lock): a thread can enter any block that has acquired the lock of the synchronization code.
Reentrant lock maximal effect: to avoid deadlocks
Exclusive lock:
Shared locks:
Since the rotation: it is trying to acquire a lock thread does not block immediately, instead of using a circular fashion to try to acquire the lock.
Benefits: reducing the consumption of thread context switches,
Disadvantages: consumes CPU cycles
Second, a spin lock your handwriting