1 / 52
文档名称:

PROTOCOLS基于锁的协议.ppt

格式:ppt   大小:719KB   页数:52页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

PROTOCOLS基于锁的协议.ppt

上传人:dyx110 2021/1/31 文件大小:719 KB

下载得到文件列表

PROTOCOLS基于锁的协议.ppt

文档介绍

文档介绍:Chapter 16: Concurrency Control
Lock-Based Protocols(基于锁的协议)
Timestamp-Based Protocols(基于时间戳的协议)
Validation-Based Protocols(基于有效性检查的协议)
Multiple Granularity(多粒度)
Multiversion Schemes(多版本机制)
Deadlock Handling(死锁处理)
Insert and Delete Operations(插入与删除处理)
Lock-Based Protocols(基于锁的协议)
A lock is a mechanism to control concurrent access to a data item
Data items can be locked in two modes :
1. exclusive排他锁(X) mode. Data item can be both read as well as written. X-lock is requested using lock-X instruction.
2. shared共享锁(S) mode. Data item can only be read. S-lock is requested using lock-S instruction.
Lock requests are made to concurrency-control manager. Transaction can proceed only after request is granted.
Lock-Based Protocols (Cont.)
Lock-compatibility matrix(锁相容性矩阵)
A transaction may be granted a lock on an item if the requested lock is compatible with locks already held on the item by other transactions
Any number of transactions can hold shared locks on an item, but if any transaction holds an exclusive on the item no other transaction may hold any lock on the item.
If a lock cannot be granted, the requesting transaction is made to wait till all incompatible locks held by other transactions have been released. The lock is then granted.
Lock-Based Protocols (Cont.)
Example of a transaction performing locking:
T1: lock-X(B) T2: lock-S(A)
read (B) read (A)
B:=B-50 unlock(A)
write(B) lock-S(B)
unlock(B) read (B)
lock-X(A) unlock(B);
read(A) display(A+B)
A:=A+50
write(A)
unlock(B)
Lock-Based