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

dbms和sql_DBMS | 并发控制和各种并发控制方法相关推荐

  1. linux并发控制方法,linux系统并发控制

    在linux在网络应用中的并发控制是linux构建网络服务的基础,下面列出linux并发控制的点 文件打开数量控制 1.进程文件打开数量控制 ulimit -n显示当前用户每个进程允许打开的最大文件数 ...

  2. linux 两个驱动 竞态,第7章 Linux设备驱动中的并发控制之一(并发与竞态)

    本章导读 Linux设备驱动中必须解决的一个问题是多个进程对共享资源的并发访问,并发的访问会导致竞态(竞争状态). Linux提供了多种解决竞态问题的方式,这些方式适合不同的应用场景. 7.1讲解了并 ...

  3. java多线程并发实例_JAVA多线程的并发控制|java多线程并发实例

    java的多线程实现主要有两种,一种是继承Thread,一种是实现Runnable接口,这个是java最基本的多线程知识.这里要补充一下,runnable接口中的run方法是不返回任何内容的,如果想返 ...

  4. 【数据库】数据库保护

    文章目录 事务 定义 事务的ACID准则 数据库完整性 数据的安全性 数据库恢复技术 恢复的定义 恢复的基本原则和实现方法 数据库的故障类型和恢复方法 检查点恢复技术 并发控制 封锁 封锁的粒度 活锁 ...

  5. mongodb mysql并发_MongoDB:锁和并发控制

    MongoDB:锁和并发控制 本文主要介绍两部分内容,第一部分是MongoDB的锁,第二部分是MongoDB的并发控制.这都跟MongoDB性能和效率相关的,有助于在使用MongoDB过程中,知道哪些 ...

  6. 一文读懂三种并发控制机制(封锁、时间戳、有效性确认,大量例子+证明)

    文章目录 并发控制 概述 事务特性 定义 并发控制机制 串行调度和可串行调度 调度 串行调度 可串行化调度 事务和调度的记法 冲突可串行化 冲突 优先图 证明 使用锁的可串行化实现 锁 封锁调度器 两 ...

  7. 如何控制并发和控制死锁(内含pb的处理要点)

    锁的概述 一. 为什么要引入锁 多个用户同时对数据库的并发操作时会带来以下数据不一致的问题: 丢失更新 A,B两个用户读同一数据并进行修改,其中一个用户的修改结果破坏了另一个修改的结果,比如订票系统 ...

  8. (数据库系统概论|王珊)第十一章并发控制-第一节:并发控制概述

    文章目录 一:事务运行方式 (1)概述 (2)计算 (3)调度 (4)串行调度和并发调度 二:并发控制 (1)并发操作带来的数据不一致性问题 A:丢失修改 B:读脏数据 C:不可重复读 (2)并发控制 ...

  9. 【Elasticsearch】 Elasticsearch并发冲突问题

    1.概述 作者:缓慢移动的蜗牛 链接:https://www.jianshu.com/p/7a3652bae8a4 来源:简书 著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 转 ...

最新文章

  1. 长沙网络推广浅析影响网站快照更新时间的因素是什么?
  2. 改变DIV的背景颜色透明度,但其中的文字不受影响?
  3. 超棒的jQuery密码强度检验插件 - Complexify
  4. SqlServer开发利器—SQL Prompt5
  5. C#的变迁史02 - C# 2.0篇
  6. Dll注入技术之劫持注入
  7. Cartographer—ROS中的安装
  8. Pandas将列表(List)转换为数据框(Dataframe)
  9. 世上最好的共享内存(Linux共享内存最透彻的一篇)上集
  10. 学习Wireshark之二:数据包分析
  11. Windows 完成端口编程
  12. accept函数的参数不是随便填的
  13. 两套系统同个服务器,同一服务器运行两套workerman程序有什么需要特别修改的吗...
  14. 135微信编辑器html模式,135微信编辑器官网【设置思路】
  15. win7更换锁屏壁纸(操作步骤)
  16. CALL和RET指令---汇编学习笔记
  17. 2020CCF BDCI 企业非法集资风险预测-线上0.848(水哥的baseline),在此基础已做到线上0.848,排名前1%(参赛队伍3000+))。
  18. 最新2020年1月份编程语言排行榜详情
  19. Liang-GaRy啃linux书想吐(六)
  20. 13 面向对象-继承与抽象类

热门文章

  1. linux 7 没有权限访问,[CentOS 7系列]文件或目录的权限与属性
  2. mysql把用户权限授予新用户_MySQL新建普通用户和库并授予新用户对新库的所有权限...
  3. jquery中点击切换的实现
  4. Socket.io 深入理解
  5. 《从零构建前后分离的web项目》准备 - 前端了解过关了吗?
  6. python执行linux和window的命令
  7. 长为N的数组,元素范围是0-N-1,其中只有一个数是重复的,找出这个重复元素...
  8. PostgreSQL 9.6 keepalived主从部署
  9. pandas.read_csv参数详解
  10. ParameterizedTypeImpl