views:

37

answers:

1

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~

+1  A: 

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.

Matt Rogish