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

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

问题描述

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

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导致:

锁确保数据的逻辑一致性,它们通过锁定表,长时间保持(例如2PL)和部分死锁检测机制来实现。

"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?

提前感谢〜

推荐答案

,但这里是Oracle的一个很好的解释。

It really depends on your DBMS, but here's a good explanation for Oracle.

http://www.dba-oracle.com/t_lru_latches.htm


锁存器类似RAM存储器的锁
结构以防止并发
访问并确保
内核代码的串行执行。当搜索,
添加或从
缓冲区缓冲区中删除缓冲区时,使用LRU(最近使用
)锁存器,只能通过一个进程执行一个动作

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天全站免登陆