dbms_DBMS | 并发控制

dbms

Management of concurrent transaction execution is known as “Concurrency Control”. Transaction management in DBMS handles all transaction, to ensure serializability and isolation of transaction. DBMS implement concurrency control technique so that the consistency and integrity of the database can be hold.

并发事务执行的管理称为“并发控制” 。 DBMS中的事务管理处理所有事务,以确保事务的可串行性和隔离性。 DBMS实施并发控制技术,以便可以保持数据库的一致性和完整性。

The processes of managing simultaneously operation such that update, create, insert, delete on the database without having an interface with one another, known as concurrency control. It can be performed by various methods such as locking technique, time stamp technique, validation based technique.

同时管理操作的过程,例如在数据库上相互更新,创建,插入,删除而无需相互接口,这称为并发控制。 它可以通过各种方法执行,例如锁定技术,时间戳技术,基于验证的技术。

并发控制的锁定技术 (Locking Technique for Concurrency Control)

Locking is a procedure which controls concurrent access of the data. If one transaction is accessing the database, a lock may be denied access to other transaction to prevent the incorrect result. Locking technique is one of the most widely used mechanisms to ensure serializability. The principle of locking technique is that a transaction must obtain read or write lock in the database before it can perform a read or write operation.

锁定是控制并发访问数据的过程。 如果一个事务正在访问数据库,则可以拒绝锁访问其他事务,以防止产生错误的结果。 锁定技术是确保可序列化性的最广泛使用的机制之一。 锁定技术的原理是,事务必须先获得数据库中的读取或写入锁定,然后它才能执行读取或写入操作。

There are some basic rules for locking technique are as following:

锁定技术有一些基本规则,如下所示:

  • If a transaction has read lock on the data item, it can read the item but can’t update it.

    如果事务对数据项具有读取锁定,则它可以读取该项目但不能更新它。

  • If a transaction has read lock on the data item, other transaction can read on data item but can’t write on the data item.

    如果事务对数据项具有读取锁定,则其他事务可以在数据项上读取,但不能在数据项上写入。

  • If a transaction has to write lock on the data item, it can both read and update data item.

    如果事务必须在数据项上写锁,则它可以读取和更新数据项。

  • If a transaction has to write lock on data item then the other transaction neither read nor write on the data item.

    如果一个事务必须在数据项上写锁,则另一个事务既不在该数据项上读写。

锁定方式 (Mode of Locking)

There are basically two types of modes in which a data item may be locked:

基本上有两种模式可以锁定数据项:

  1. Shared Lock

    共享锁

  2. Exclusive Lock

    排他锁

1)共享锁 (1) Shared Lock)

If a transaction T has a shared lock on the data item q, then T can read but can’t write on q data item. It is denoted by (S).

如果事务T在数据项q上具有共享锁,则T可以在q数据项上读取但不能写入。 用( S )表示。

2)排他锁 (2) Exclusive Lock)

If transaction T has an exclusive lock on data item q, then T can read and write both on the data item. It is denoted by (X).

如果事务T对数据项q具有排他锁,则T可以在数据项上进行读写操作。 用( X )表示。

In order to access the data item, these conditions should be followed:

为了访问数据项,应遵循以下条件:

  • Transaction T must first lock it. If the data item is already locked by another transaction which is not comparable then T must wait until have been released & unlock.

    事务T必须首先将其锁定。 如果数据项已经被另一个不可比较的事务锁定,则T必须等待直到被释放并解锁。

  • The transaction must hold a lock on data item when it is accessed.

    事务在访问时必须对数据项保持锁定。

  • After that unlock it.

    之后,将其解锁。

A matrix given below shows the comparability between two lock modes:

下面给出的矩阵显示了两种锁定模式之间的可比性:

Shared (S)Exclusive(X)
STT
XFF
共享的(S) 独家(X)
小号 Ť Ť
X F F

Example:

例:

Consider the following 2 transaction T(read(a), read(b)).

考虑以下2个事务T(read(a),read(b))

T1T2
read(a)
read(b)
if a=0
then b=b+1
write(b)

T1 T2
read(a)
read(b)
if a=0
then b=b+1
write(b)

Find lock and unlock instruction of the transaction T1 & T2. Then observe the locking protocol? The execution of transaction is deadlock?

查找交易T1和T2的锁定和解锁指令。 然后遵守锁定协议? 交易的执行是否陷入僵局?

Solution:

解:

Lock and unlock instruction:

锁定和解锁说明:

T1T2
lock S(a)
read(a)
lock X(b)
read(b)
if a=0
then b=b+1
write(b)
unlock(b)
unlock(a)
lock S(b)
read(b)
lock (a)
read(a)
if b=0
then a=a+1
write(a)
unlock(a)
unlock(b)

T1 T2
T1T2
lock S(a)
lock S(b)
lock X(b)
lock X(a)
T1 T2
锁S(a)
锁S(b)
锁X(b)
锁X(a)

Yes, transaction has deadlock.

是的,交易陷入僵局。

翻译自: https://www.includehelp.com/dbms/concurrency-control.aspx

dbms

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/543825.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ruby 发送post请求_使用Ruby发送电子邮件

ruby 发送post请求Ruby发送电子邮件 (Ruby sending email) Sending emails and routing email among mail servers are handled by Simple Mail Transfer Protocol commonly known as SMTP. Net::SMTP class is a predefined class in Ruby’s library which is purposefully d…

Centos Git1.7.1升级到Git2.2.1

Centos Git1.7.1升级到Git2.2.1安装需求:># yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc ># yum install asciidoc xmlto -y ># yum install gcc perl-ExtUtils-MakeMaker error: /utf8.c:463: undefined r…

tgc 什么意思 tgt_TGT的完整形式是什么?

tgc 什么意思 tgtTGT:训练有素的研究生老师 (TGT: Trained Graduate Teacher) TGT is an abbreviation of Trained Graduate Teacher. It is a title, not a teaching program that is given to a graduate person who has done completion of training in teaching…

svn的使用(Mac)

2019独角兽企业重金招聘Python工程师标准>>> 从服务器下载代码 在终端中输入svn checkout svn://localhost/mycode --username用户名 --password密码 /Users/apple/Documents/code指令意思:将服务器中mycode仓库的内容下载到/Users/apple/Documents/myCo…

scala语言示例_标有示例的Scala关键字

scala语言示例Scala | 任一关键字 (Scala | Either Keyword) Either is a container similar to the option which has two values, they are referred to as children. The left and right children are named as the right child and left child. 这是一个类似于选项的容器&a…

css 中文文字字体_使用CSS的网络字体

css 中文文字字体CSS | 网络字体 (CSS | Web fonts) Web fonts allow people to use fonts that are not pre-installed in their computers. When you want to include a particular font simply include the font file on your browser and it will be downloaded. Web字体允…

Ajax实践之用户是否存在

关于Ajax在之前的学习中,已经对它的基础知识有了初步的了解。仅仅是欠实践。那么接下来就让实践来检验一下真理吧! 基础见:http://blog.csdn.net/liu_yujie2011com/article/details/29812777 那么先回忆一下,Ajax是用来解决什么问…

vb 导出整数 科学计数法_可整数组的计数

vb 导出整数 科学计数法Problem statement: 问题陈述: Given two positive integer n and m, find how many arrays of size n that can be formed such that: 给定两个正整数n和m ,找出可以形成多少个大小为n的数组: Each element of the …

C4.5决策树算法概念学习

数据挖掘一般是指从大量的数据中自动搜索隐藏于其中的有着特殊关系性的信息的过程。 •分类和聚类•分类(Classification)就是按照某种标准给对象贴标签,再根据标签来区分归类,类别数不变。•聚类(clustering)是指根据“物以类聚”的原理,将本…

python修改y轴刻度_Python | Y轴刻度限制

python修改y轴刻度In some cases, we need to visualize our data within some defined range rather than the whole data. For this, we generally set the y-axis scale within a limit and this ultimately helps us to visualize better. Sometimes, it acts as zooming a…

em算法示例_带有示例HTML'em'标签

em算法示例<em>标签 (<em> Tag) <em> tag in HTML is used to display the text in emphasized form. <em> tag add semantic meaning to the text, text inside it is treated as emphasized text. HTML中的<em>标记用于以强调形式显示文本。 &…

联合使用 HTML 5、地理定位 API

查找并跟踪位置坐标以用在各种 Web 服务中 在这个由五个部分所组成的系列的第一部分中&#xff0c;您将接触到移动 Web 应用程序中最流行的新技术&#xff1a;地理定位。高端智能手机都内置 GPS&#xff0c;现在您将了解 Web 服务如何使用它。在本文中&#xff0c;您将学到如何…

list下界_下界理论

list下界下界理论 (Lower Bound Theory) Lower bound (L(n)) is a property of the specific problem i.e. the sorting problem, matrix multiplication not of any particular algorithm solving that problem. 下界(L(n))是特定问题(即排序问题)的矩阵&#xff0c;不是解决该…

Mac OSX 安装nvm(node.js版本管理器)

我的系统 1.打开github官网https://github.com/&#xff0c;输入nvm搜索,选择creationix&#xff0f;nvm&#xff0c;打开 2.找到Install script&#xff0c;复制 curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash . 3. 打开终端&#xf…

HTML中的类属性

The class attribute in HTML is used to specify or set a single or multiple class names to an element for an HTML and XHTML elements. Its majorly used to indicate a class in a style sheet. HTML中的class属性用于为HTML和XHTML元素指定或设置一个元素名称或多个类…

关于HTML5标签不兼容(IE6~8)

HTML5的语义化标签以及属性&#xff0c;可以让开发者非常方便地实现清晰的web页面布局&#xff0c;加上CSS3的效果渲染&#xff0c;快速建立丰富灵活的web页面显得非常简单。 比较常用的HTML5的新标签元素有&#xff1a; <header>定义页面或区段的头部&#xff1b;<na…

zzz,zzz,zz9_ZZZ的完整形式是什么?

zzz,zzz,zz9ZZZ&#xff1a;睡觉&#xff0c;无聊&#xff0c;累 (ZZZ: Sleeping, Bored, Tired) ZZZ is an abbreviation of "Sleeping, Bored, Tired". ZZZ是“睡觉&#xff0c;无聊&#xff0c;累了”的缩写 。 It is an expression, which is commonly used in …

uboot启动 及命令分析(3)

u-boot命令 先贴一个重要结构,位于uboot/include/command.h,这个结构代表每个uboot命令 struct cmd_tbl_s { char *name; /* Command Name */ int maxargs; /* maximum number of arguments*/ int repeatable;/* autorepeat allowed? */ /* Implem…

Mozilla开源了VR框架A-Frame

Mozilla创建并开源了A-Frame&#xff0c;这是一个用于在桌面浏览器、智能手机和Oculus Rift上创建VR场景的框架。\\A-Frame是一个在浏览器中创建VR体验的开源框架。该框架由Mozilla的MozVR团队创建和开发。A-Frame使用了一个在游戏开发中经常使用的“实体-组件&#xff08;Enti…

css网格_CSS网格容器

css网格CSS | 网格容器 (CSS | Grid Containers) There are numerous ways to display our list items or elements. For instance, we can display them in the navigation bar, in a menu bar and whatnot. Well, it would be right to say that there are many more such me…