synchronized详解
- synchronized原理
- .升级过程
- 汇编实现
- vs reentrantLock的区别
java源码层级
synchronized(o)
字节码层级
monitorenter moniterexit
JVM层级(Hotspot)
package com.gmeini.insidesync;
import org.openjdk.jol.info.ClassLayout;
public class T01_Sync1 {
public static class Lock {
}
public static void main(String[] args) {
Lock lock = new Lock();
System.out.println(ClassLayout.parseInstance(lock).toPrintable());
}
}
com.gemini.insidesync.T01_Sync1$Lock object internals:
OFFSET SIZE TYPE DESCRIPTION VALUE
0 4 (