Java-SSM框架相关的面试题收集和整理 | 干货面试教程总结与分享
发布时间
阅读量:
阅读量
什么是自旋锁和互斥锁?
由于CLH锁是一种自旋锁,那么我们先来看看自旋锁是什么?
**self-rotation lock is essentially a mutual exclusion lock. The distinction lies in that threads unable to acquire the lock will remain in a busy-waiting state indefinitely until the lock is released. In this state, waiting threads do not enter a sleep mode but instead waste CPU cycles in an endless loop. Consequently, self-rotation locks are most suitable for scenarios where the expected acquisition time of the lock is brief.
本文提到了自旋lock机制后,我们不妨顺便探讨一下互斥lock的概念。其中,在多态对象模型中使用较多的是self lock机制(即self-locking),其核心思想是:当一个对象 instance 在被其他 instance 夺取时(即同
全部评论 (0)
还没有任何评论哟~
