Java中的锁机制
Java中的鎖機制:
- Neutral: Unlocked
- Biased: Locked/Unlocked + Unshared
- Stack-Locked: Locked + Shared but uncontended,The mark points to displaced mark word on the owner thread's stack.
- Inflated: Locked/Unlocked + Shared and contended,Threads are blocked in monitorenter or wait().,The mark points to heavy-weight "objectmonitor" structure.
參考:
http://openjdk.java.net/groups/hotspot/docs/RuntimeOverview.html
AbstractQueuedLongSynchronizer,StampedLock源碼
http://cs.rochester.edu/research/synchronization/pseudocode/ss.html
轉載于:https://blog.51cto.com/thinklili/2292328
總結
- 上一篇: Phone相关进程及通信
- 下一篇: Java 使用枚举类的实例