在同时访问数据库的上下文中,锁和锁之间有什么区别? [英] What is the difference between a lock and a latch in the context of concurrent access to a database?
问题描述
Google导致:
锁确保数据的逻辑一致性,它们通过锁表实现,保持很长时间(例如2PL)和部分死锁检测机制。
锁定是像信号量,它们保证数据和资源的物理一致性,这在事务级别是不可见的。
但是,我还是很困惑。可以有人详细说一下吗?和锁管理器究竟做什么?
提前感谢〜
,但这里是Oracle的一个很好的解释。
http://www.dba-oracle.com/t_lru_latches.htm
锁存器类似于RAM内存的锁
结构以防止并发
访问并确保
内核代码的串行执行。当搜索,
添加或从
缓冲区缓冲区中删除缓冲区时,使用LRU(最近使用
)锁存器,只能通过一个进程执行一个操作
I am trying to understand a paper on concurrent B-tree, in which the author mentioned latch vs lock, and how latches do not need a "Lock Manager". I have been trying to figure out what are differences between those two for two days.
Google resulting in:
"locks assure logical consistency of data. They are implemented via a lock table, held for a long time (e.g. 2PL), and part of the deadlock detection mechanism.
latches are like semaphores. They assure physical consistency of data and resources, which are not visible at the transactional level"
However, I am still pretty confused. Can some one elaborate on this? and what exactly does a lock manager do?
Thanks in advance~
It really depends on your DBMS, but here's a good explanation for Oracle.
http://www.dba-oracle.com/t_lru_latches.htm
Latches are like locks for RAM memory structures to prevent concurrent access and ensure serial execution of kernel code. The LRU (least recently used) latches are used when seeking, adding, or removing a buffer from the buffer cache, an action that can only be done by one process at a time.
这篇关于在同时访问数据库的上下文中,锁和锁之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!