dbms和sql_DBMS | 并发控制和各种并发控制方法

dbms和sql

并发控制 (Concurrency Control)

The concurrency control is the coordination of the simultaneous execution of a transaction in a multiuser database system. The concurrency control can ensure the serializability of the transaction in a multiuser database environment and that is the main objective of concurrency control. There is only One way in which the required data items can be accessed in a mutually exclusive manner. That is while one transaction is accessing a data item another transaction can modify that data item. The most common method used to implement this requirement is to allow a transaction to access a data item only if it is currently holding a lock on that item.

并发控制是在多用户数据库系统中同时执行事务的协调。 并发控制可以确保事务在多用户数据库环境中的可序列化性,这是并发控制的主要目标。 只有一种方法可以以互斥的方式访问所需的数据项。 也就是说,当一个事务正在访问数据项时,另一事务可以修改该数据项。 用于实现此要求的最常见方法是仅在事务当前持有该数据项的锁时,才允许该事务访问该数据项。

多种并发控制方法 (Various methods of concurrency control)

1)二进制锁定 (1) Binary Locking)

A data item can be locked in various modes:

数据项可以以多种模式锁定:

  • Shared mode (S): when any transaction Ti has 0 shared mode lock on any data item Q then Ti can only read but cannot write Q.

    共享模式(S) :当任何事务Ti对任何数据项Q拥有0个共享模式锁定时, Ti只能读取而不能写入Q。

  • Exclusive mode (X): Any transaction Ti can read and write Q only If a transaction Ti has obtained an exclusive mode lock (denoted by X) on any data item Q.

    独占模式(X) :只有事务Ti获得了对任何数据项Q的独占模式锁(由X表示),任何事务Ti才能读写Q。

  • The transaction makes the request to the concurrency control manager. It can proceed only when the concurring control manager grants the lock to the transaction.

    事务向并发控制管理器发出请求。 仅当并发控制管理器将锁定授予事务时,它才能继续进行。

2)基于锁定的协议 (2) Locked based protocol)

In locked based protocol basic idea is first to acquire a lock before accessing a data item directly after use should delete that data item. Because of this, we can avoid a clash. Here transaction uses types of locks. Shared lock and exclusive lock.

在基于锁定的协议中,基本思想是首先获取一个锁,然后再直接使用该数据项,然后再删除该数据项。 因此,我们可以避免冲突。 在这里,事务使用锁的类型。 共享锁和排他锁。

3)共享锁 (3) Shared lock)

If the transaction has acquired a shared lock on a data item Q than its own perform only read operation but if a transaction has acquired exclusive lock then it can perform read as well as write operation.

如果事务已获取了对数据项Q的共享锁,而不是事务本身仅执行读操作,但是如果事务已获取了排他锁,则它可以执行读和写操作。

4)两相锁定 (4) Two phase locking)

In two-phase locking every transaction work in 2 phase in the entire span. Growing phase and shrinking phase. In the growing phase, only a transaction may acquire locks but cannot release only lock while in shrinking phase a transaction can only release lock but cannot any acquire any lock.

在两阶段锁定中,每个事务在整个范围内分两阶段进行。 生长阶段和收缩阶段。 在增长阶段,只有事务可以获取锁,而不能仅释放锁,而在收缩阶段,事务只能释放锁,而不能获取任何锁。

Growing and shrinking phase terminology is applicable to the transaction not suitable.

增长和收缩阶段术语适用于不适合的交易。

5)严格的2相锁定 (5) Rigorous 2 phase locking)

In rigorous 2 phase locking, we remove shrinking phases from the system i.e. a transaction can acquire locks but cannot release any lock because of which dirty read is not possible. This protocol ensures conflict and view serializability recoverability and cascadeless but may suffer from deadlock.

在严格的两阶段锁定中,我们从系统中删除了缩小的阶段,即,事务可以获取锁定,但不能释放任何锁定,因为这样不可能进行脏读。 该协议可确保冲突并查看可序列化的可恢复性,并且无级联,但可能会出现死锁。

6)严格2相锁相 (6) Strict 2 phase locking)

In strict 2 phase locking is an improvement over rigorous 2 phase locking ensure rigorous two-phase locking where unlocking of a shared lock is allowed in the shrinking phase.

在严格的2相锁定中,是对严格2相锁定的一种改进,可确保严格2相锁定,其中在收缩阶段允许对共享锁进行解锁。

7)保守2相锁相 (7) Conservative 2 phase locking)

In conservation 2 phase locking we remove growing phase from the system and every transaction is first required to acquire all the lock first before performing any read or write. It ensures conflict serializability view serializability and deadlock independence but suffers from recoverability and cascades.

在保护2阶段锁定中,我们从系统中删除了增长阶段,在执行任何读取或写入操作之前,首先需要每个事务先获取所有锁定。 它确保了冲突的可序列化性,视图可序列化性和死锁独立性,但是会遭受可恢复性和级联的困扰。

8)时间戳记协议 (8) Time stamping protocol)

In this method, we decide to order before transaction enters into the system here every transaction is given time stamp Ts(Ti) which is actually the value of the system clock when the transaction enters into the system. This time stamp will remain constant until the transaction is in the system.

在这种方法中,我们决定在事务进入系统之前进行排序,此处为每个事务都赋予时间戳Ts(Ti),该时间戳实际上是事务进入系统时系统时钟的值。 该时间戳将保持不变,直到事务在系统中。

Write every data item Q use associate two time stamp read time stamp of Q and write time stamp of Q.

写入每个数据项Q使用关联Q的两个时间戳读取时间戳和Q的写入时间戳。

Note: If a read operation is allowed than reading timestamp must be updated and if a write operation is allowed than write timestamp must be updated. If an operation is not allowed than transaction must enter into a system with a new timestamp.

注意:如果允许读取操作,则必须更新读取时间戳;如果允许写入操作,则必须更新写入时间戳。 如果不允许某项操作,则事务必须以新的时间戳进入系统。

翻译自: https://www.includehelp.com/dbms/concurrency-control-and-various-methods-of-concurrency-control.aspx

dbms和sql

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

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

相关文章

修改窗口图标 AfxRegisterWndClass()

LPCTSTR AFXAPI AfxRegisterWndClass(UINT nClassStyle,HCURSOR hCursor 0,HBRUSH hbrBackground 0,HICON hIcon 0 ); 可以简单修改一个窗口的注册类,当然也可以用SetWindowsLong()来实现。转载于:https://www.cnblogs.com/magic-cube/archive/2011/05/05/2038…

linux停止ssh服务的命令,开启、关闭、查看SSH服务

一、临时启用SSH服务1、通过SSH服务器的启动脚本文件启动SSH服务通过OpenSSH服务器的脚本文件“/etc/rc.d/init.d/sshd”启动SSH服务,命令执行如下。/etc/rc.d/init.d/sshd start命令执行后, SSH服务开始运行。2、使用Linux下的service命令启动SSH服务使…

XCHE命令

功能: 交换数据,交换两个操作数内容 形式: xche reg,reg xche reg,mem xche mem,regreg:寄存器;mem:内存单元 比如: xche eax,ebx;交换eax和ebx的内容 xche eax,[ebx]

软件测试经典网站(转)

软件测试经典网站网址简介http://bdonline.sqe.com/一个关于网站测试方面的网页,对这方面感兴趣的人可以参考http://citeseer.nj.nec.com/一个丰富的电子书库,内容很多,而且提供著作的相关文档参考和下载,是作者非常推荐的一个资料参考网站http://groups.yahoo.com/group/LoadR…

ai人工智能在手机的应用_强化学习在人工智能中的应用

ai人工智能在手机的应用The reinforcement learning is being used in many Intelligent Systems and the developers are seeing a great scope in it for current and future developments in the field of computers and robotics. This is because, the Reinforcement Lear…

LEA指令

功能:取偏移地址 格式: LEA reg,memreg:寄存器;mem:内存单元 例如: LEA AX,[1000H]将1000源操作数[1000H]的偏移地址1000H送到AX中。 理解的时候可将[]去掉,等同于: m…

参考站点

26个杰出的jQuery幻灯片插件http://woshao.com/article/6807a76a43d611e081e1000c2959fd2a/周公的专栏http://blog.csdn.net/zhoufoxcn/ W3SCHOOL在线教程http://www.w3school.com.cn/jQuery API 中文版http://www.css88.com/jqueryapi在ASP.NET中使用Highcharts js图表http://…

linux多进程通过中断实现,Linux驱动中断上下文中会发生什么结果实验测试

一、前言每一个Linux驱动工程师都知道这样一个准则:在中断上下文中不能睡眠。但是为什么interrupt context中不能调用导致睡眠的kernel API呢?如果驱动这么做会导致什么样的后果呢?这就是本文探讨的主题。为了理解这个主题,我们设…

'unsigned char'-C编程中的声明,赋值和用法

char is a data type in C programming language which can store value from -128 to 127. It generally used to store character values. char是C编程语言中的数据类型,可以存储从-128到127的值 。 它通常用于存储字符值。 unsigned is a qualifier which is us…

cmp指令

功能:比较 格式: CMP destination,sourceCMP 指令比较整数。字符代码也是整数,因此可以用 CMP 指令。 如果比较的是两个无符号数,则零标志位和进位标志位表示的两个操作数之间的关系 如果比较的是两个有符号数,则符…

游戏后的迷茫

9月份花了很多时间耐下心的玩了一个游戏——三国志11,这个是我继三国5以后耐下心玩得最多的一个游戏了,也是2年来耐下心玩得最多的游戏。现在是不是真的太浮躁了。连玩游戏都耐不下心。每天的泡论坛,看电影,下载,刻录的…

linux下获取时间的函数

相关函数 time,ctime,gmtime,localtime //--------------------------------------------------------------------------------------------------------------------------------------------------------// asctime(将时间和日…

linux 内核配置 dns,linux bind dns简单配置

操作系统版本:[roottest ~]# cat /etc/issueRed Hat Enterprise Linux AS release 4 (Nahant Update 4)Kernel r on an m内核:[roottest ~]# uname -aLinux test 2.6.9-42.EL #1 Wed Jul 12 23:16:43 EDT 2006 i686 i686 i386 GNU/Linux[roottest ~]#需要…

鸡兔同笼问题

已知鸡兔的总数量为n,总腿数为m。输入n和m,依次输出鸡的数目和兔的数目。如果无解,则输出No answer。 样例输入:①14 32 ② 10 16 样例输出:①12 2 ②No answer 【分析】 设鸡有a只,兔有b只&#xff0c…

两个人 三声叹 一钵泪

寂寞的人,流下的泪珠是单数的 转载于:https://www.cnblogs.com/aque1984/archive/2006/10/02/520282.html

散列碰撞_散列中的碰撞和碰撞解决技术

散列碰撞Prerequisite: Hashing data structure 先决条件: 哈希数据结构 碰撞 (Collisions) Hash functions are there to map different keys to unique locations (index in the hash table), and any hash function which is able to do so is known as the per…

call和ret(f)指令

call指令 CPU执行call指令时,进行两步操作 将当前的ip(eip)或者cs和ip(ecs和eip)压入栈中跳转到标号处 call 标号 将当前的IP压栈后,转到标号处执行指令 相当于: push ip jmp near ptr 标号…

天翼云linux远程密码不对,天翼云主机远程连接

天翼云主机如何进行远程连接?操作系统不同自然连接方式也是不一样,今天我们分别介绍一下天翼云Windows主机远程连接和Linux云主机远程连接的方法。一、Windows云主机远程连接(1)在电脑连接网络的情况下,点击桌面左下角的windows图标&#xff…

pku2503 Babelfish

额&#xff0c;跟hdu的1075很像&#xff0c;不过比那题简单多了&#xff0c;就是读入时有点麻烦&#xff0c;用到了一个函数 具体看代码吧&#xff0c;这题没什么&#xff0c;不过我的内存开了太多了&#xff0c;不解…… #include<stdio.h> #include<string.h> #i…

JAVA JDK环境渲染

①&#xff08;随便在哪个盘里都行&#xff09;创建一个文件夹名称&#xff1a;Java&#xff1b; ②在文件夹Java下创建一个子文件夹 名称&#xff1a;jdk&#xff1b; ③在子文件夹jdk下再创建一个子文件夹 名称jre&#xff1b; &#xff08;文件夹名称随便&#xff0c;我这…