When using X-locks and S-Locks to lock data objects, there are rules that need to be agreed, such as when to apply for X-lock or S-lock, lock-in time, when to release, and so on. These rules are called the blockade Agreement (Locking Protocol). The different rules governing the way in which closures are imposed have created different kinds of blockade agreements. Different blocking protocols provide certain guarantees for the correct scheduling of concurrent operations at different levels.
一、一级 Blockade protocol
the first-level blocking protocol is that transaction T must be X-locked before the data R is modified until the end of the transaction is released. The end of the transaction consists of a normal end (COMMIT) and an abnormal end (ROLLBACK).
A first-level blocking protocol prevents loss of modification and guarantees that transaction T is recoverable. You can use the first-level blocking protocol to resolve lost modification issues.
in the first-level blocking protocol, if only the read data does not modify it, it does not need to be locked, it does not guarantee repeatable read and do not read "dirty" data.
二、二级 Blocking protocol
level Two blocking protocol is: first-class blocking protocol plus transaction T before reading the data r must be added s lock, read the rear can release S lock.
the level Two blocking protocol prevents the loss of modifications and further prevents the reading of "dirty" data. However, in the level two blocking protocol, the S lock can be released after reading the data, so it cannot guarantee repeatable reads.
三、三级 Blocking protocol
level Three blocking protocol is: first level blocking protocol plus transaction T before reading the data r must lock it before it is released until the end of the transaction. The
level Three lockdown protocol prevents non-repeatable reads, in addition to preventing loss of modification and non-reading of "dirty" data.
The main difference between the above level three protocol is what operations need to apply for blocking and when to release.
Resources:
http://zhidao.baidu.com/question/29901226
http://e-learning.zjgsu.edu.cn/moodle/mod/resource/view.php?inpopup=true&id=596
Http://202.207.137.111/sjkwz/htm/8.3.htm
Http://course.cug.edu.cn/cug/database/netclass/CHAPT8/8.3/8.3.htm