static synchronized method's lock is on the class-instance. non-static synchronized method's lock is on the object instance.
Thread deadlocking is the situation when thread execution grinds to a halt because the code is waiting for locks to be removed from objects. It occurs when both threads are waiting for each others' locks to be released.
Memory consistency:理解 the happens-before relationship 可幫助避免 memory consistency error. Happens-before relationship: a guarantee that memory writes by one specific statement are visible to another specific statement.