最后,我认识到激活锁省略似乎和被锁对象的数据大小有关系。
Finally I came to recognize that there seems to be some relation between the enabling of lock elision and the data size of the locked object.
锁粗化就是把使用同一锁对象的相邻同步块合并的过程。
Lock coarsening is the process of merging adjacent synchronized blocks that use the same lock object.
锁对象的工作原理和通过同步方法严格实现的锁一样。
Lock objects work very much like the implicit locks used by synchronized code.
译文:锁对象同步代码依赖于一种简单的重入锁。
Synchronized code relies on a simple kind of reentrant lock.
同严格实现的锁一样,一个线程一次只能拥有一个锁对象。
As with implicit locks, only one thread can own a lock object at a time.
锁对象比严格的锁最大的优势是他们能够从获得一个锁返回。
The biggest advantage of lock objects over implicit locks is their ability to back out of an attempt to acquire a lock.
例如,如果锁对象的类别是Object,搜索代码以引用它可能不太容易。
For example, if the lock object is of class object, it may not be easy to search the code for references to it.
多个控制线程可以同时在队列中添加数据或删除数据,所以需要用互斥锁对象管理同步。
Multiple threads of control can simultaneously try to push data to the queue or remove data, so you need a mutex object to manage the synchronization.
如果在同一个锁对象上,自旋刚刚成功过,并且持有锁的线程正在运行中,那么自旋很有可能再次成功。
If spinning succeeded on that same lock object in the recent history and the thread holding the lock is running, then spinning is likely to succeed again.
我猜测这是由于它的实现比较保守,根据不同条件(比如锁对象数据大小和其他OS特定的特性)及早地关掉了它。
My guess is that it is implemented very conservatively and disabled early based on various conditions like lock object data size and OS specific features.
另一方面,我们又不希望分配太多锁对象,特别是在ConcurrentDictionary最后只存储了很少项目的时候。
On the other hand, we don't want to allocate too many lock objects, especially if the ConcurrentDictionary only ends up storing only a small number of items.
锁模式和锁对象类型都定义在sqlmon . h包含文件中,该文件将有助于破解表函数返回的数值当量(numerical equivalent)。
Lock modes and lock object types are defined in the sqlmon.h include file, which will help you to decipher the numerical equivalents that the table function returns.
IDS允许应用程序开发人员将锁放在不同的对象上,如数据库、表、页或行、以及索引。
IDS allows application developers to place locks on different objects, like databases, tables, pages or rows, and indexes.
同步的代码块在执行之前需要与客户类对象相关的锁。
This synchronized code block acquires the lock associated with the customer class object before it executes.
新对象是从这个高速缓存的末端分配的,而不必获取堆锁,因此效率非常高。
A new object is allocated from the end of this cache without the need to grab the heap lock, so it is very efficient.
就像规范要求的那样,一个低优先级线程(优先级p3)获取了一个对象的锁,会被一个高优先级(优先级p1)的线程夺取执行权。
A low priority thread (at priority P3) acquires the lock on an object and is pre-empted by a higher priority thread (at priority P1), as the specification mandates.
DB 2使用数据库对象上的锁来确保事务的一致性。
DB2 ensures transaction consistency using locks on database objects.
本文中将学习如何使用Boostipc库实现共享内存对象、消息队列和同步文件锁。
In this article, you learn how to use the Boost IPC library to implement Shared memory objects, message queues, and synchronized file locking.
到了Version8,load工具在表本身上放置锁,因而您可以在运行数据加载操作的同时,对相同表空间中的其他表对象进行并发访问。
As of Version 8, the load utility places locks on the table itself, and you can enjoy concurrent access to other table objects in the same table Spaces while a data load operation is running.
在进入关键部分之前,调用ReentrantLock对象的lock方法,尝试并获得锁。
Before entering the critical section, the lock method of the ReentrantLock object is invoked to try and obtain the lock.
如果锁被占有,则调用Dequeue FromPool方法以从该池中检索对象。
If the lock is held, the DequeueFromPool method is called to retrieve an object from the pool.
这样的对锁的分组能够帮助程序员发现哪一个ConcurrentHashMap对象发生了最严重的锁竞争。
This grouping of locks helps programmers identity which ConcurrentHashMap object has the most serious JUC lock contentions.
wait释放对象锁,线程等待。
如果能够做到这一点,线程代码将是非常高效的,并且不会占用宝贵的互斥对象锁。
If you can do this, your threaded code will be really efficient and it won't tie up valuable mutex locks.
如果互斥对象当前处于解锁状态,那么您将获得该锁并且函数将返回零。
If the mutex is currently unlocked you'll get the lock, and this function will return zero.
通过保持较浅的锁层次结构,可以锁定最少量的对象,您能够影响最大量的需要调整优先级的线程。
By keeping lock hierarchies shallow, which translates to locking as few objects as possible, you can affect the maximum number of threads that need to be priority adjusted.
当发生这种情况时,没有获得锁的线程被置于对象的锁争用者的一个逻辑队列中。
When this happens, the thread failing to acquire the lock is put into a logical queue of lock contenders for the object.
P1线程需要同一个对象上的锁,但是在P3线程释放它之前,P1无法得到锁。
The P1 thread then needs the same object but cannot acquire the lock until the P3 thread has released it.
释放锁以后,系统从争用者的最高优先级队列的前端选择线程,以便试图锁定对象。
When a lock is released, the system chooses the thread from the front of the highest-priority queue of contenders to try to lock the object.
释放锁以后,系统从争用者的最高优先级队列的前端选择线程,以便试图锁定对象。
When a lock is released, the system chooses the thread from the front of the highest-priority queue of contenders to try to lock the object.
应用推荐