在同时访问数据库的上下文中,锁和锁之间有什么区别? [英] What is the difference between a lock and a latch in the context of concurrent access to a database?

查看:291
本文介绍了在同时访问数据库的上下文中,锁和锁之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图理解一篇关于并发B-tree的文章,其中作者提到了latch vs lock,以及锁存器如何不需要一个锁定管理器。



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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆