当前位置:网站首页>Two stage locking protocol for concurrency control
Two stage locking protocol for concurrency control
2022-07-05 21:59:00 【Short section senior】
The database management system generally adopts the method of two-stage lock protocol to realize the serializability of concurrent scheduling , So as to ensure the correctness of scheduling
Two stage lock protocol
It means that all transactions must be divided into two phases to lock and unlock data items
Reading any data 、 Before writing operations , The first thing a transaction needs to do is get a block on that data
After releasing a blockade , The transaction no longer applies for and obtains any other blockages
“ Two paragraphs ” The meaning of lock
The transaction is divided into two stages
The first stage is to get the blockade , Also known as the extension phase
Transactions can apply for any type of lock on any data item , But you can't release any locks
The second stage is to release the blockade , Also known as the contraction phase
A transaction can release any type of lock on any data item , But you can't apply for any more locks
example
Business Ti Comply with the two-stage lock protocol , The blocking sequence is :
Slock A Slock B Xlock C Unlock B Unlock A Unlock C;
|← Expansion stage →| |← Contraction stage →|
Business Tj Failure to comply with the two-stage lock agreement , The blocking sequence is :
Slock A Unlock A Slock B Xlock C Unlock C Unlock B;
The scheduling of graph follows the two-stage locking protocol , Therefore, it must be a feasible scheduling .
How to validate ?
It is a sufficient condition for serializable scheduling that transactions obey two-stage locking protocol , It's not necessary .
If both concurrent transactions follow the two-stage locking protocol , Any concurrent scheduling strategy for these transactions is serializable
If a schedule of concurrent transactions is serializable , Not all transactions are subject to the two-stage locking protocol
Two stage locking protocol and one-time blocking method to prevent deadlock
One time blocking requires every transaction to lock all data to be used at one time , Otherwise, we can't carry on , Therefore, the one-time blocking law abides by the two-stage locking agreement
However, the two-stage locking protocol does not require the transaction to lock all data to be used at one time , Therefore, transactions complying with the two-stage locking protocol may deadlock
[ example ] A transaction that abides by the two-stage lock protocol has a deadlock
Welcome to join me for wechat exchange and discussion ( Please note csdn Add )
边栏推荐
- NET中小型企业项目开发框架系列(一个)
- Official clarification statement of Jihu company
- A long's perception
- 场景化面试:关于分布式锁的十问十答
- kingbaseES V8R3数据安全案例之---审计记录清除案例
- 1.2 download and installation of the help software rstudio
- Tips for using SecureCRT
- Summary of data analysis steps
- Detailed explanation of memset() function usage
- Yolov5 training custom data set (pycharm ultra detailed version)
猜你喜欢
Huawei cloud modelarts text classification - takeout comments
A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition
华为联机对战如何提升玩家匹配成功几率
Implementation technology of recovery
Huawei fast game failed to call the login interface, and returned error code -1
ICMP introduction
极狐公司官方澄清声明
Exercise 1 simple training of R language drawing
MMAP learning
Type of fault
随机推荐
Net small and medium-sized enterprise project development framework series (one)
K210 learning notes (IV) k210 runs multiple models at the same time
Robot operation mechanism
Dbeaver executes multiple insert into error processing at the same time
DataGrid directly edits and saves "design defects"
Three components of openpyxl
Huawei fast game failed to call the login interface, and returned error code -1
K210学习笔记(四) K210同时运行多个模型
Incentive mechanism of Ethereum eth
华为云ModelArts文本分类–外卖评论
Getting started with microservices (resttemplate, Eureka, Nacos, feign, gateway)
MySQL连接断开报错MySQLdb._exceptions.OperationalError 4031, The client was disconnected by the server
Analysis and test of ModbusRTU communication protocol
Codeforces 12D ball tree array simulation 3 sorting elements
A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition
database mirroring
Recovery technology with checkpoints
微服务入门(RestTemplate、Eureka、Nacos、Feign、Gateway)
Ethereum ETH的奖励机制
How to organize an actual attack and defense drill