Optimistic vs Multi Version Concurrency Control – Differences?

Optimistic vs Multi Version Concurrency Control – Differences?

 

I am trying to find out, what the difference between optimistic concurrency control (OCC) and multi version concurrency control (MVCC) is?

So far I know that both is based on version checking for updates.

In OCC, I read about transactions that acquire no locks for reading access, only for the later update which will fail if in between the version was incremented and version checking fails. In this case the transaction will be rolled back.

In MVCC, it is basically the same, or not? Where is the difference?

 

 

I think they are sometimes used interchangeably, and if the transaction only involves one object then they are essentially the same, but MVCC is an extension of optimistic concurrency (or a version of it) that provides guarantees when more than one object is involved. Say that you have two objects, A and B, which must maintain some invariant between them, e.g. they are two numbers whose sum is constant. Now, a transaction T1 subtracts 10 from A and adds it to B, while, concurrently, another transaction T2 is reading the two numbers. Even if you optimistically update A and B independently (CAS them), T2 could get an inconsistent view of the two numbers (say, if it reads A before it’s modified but reads B after it’s been modified). MVCC would ensure T2 reads a consistent view of A and B by possibly returning their old values, i.e., it must save the old versions.

To sum up, optimistic locking (or optimistic concurrency control), is a general principle for synchronization w/o locks. MVCC is an optimistic technique which allows isolated transactions which span multiple objects.

 

转载于:https://my.oschina.net/u/138995/blog/180232

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/109964.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • JMESPath_正则表达式语法

    JMESPath_正则表达式语法前言JMESPath是JSON的查询语言。您可以从JSON文档中提取和转换元素官方文档:https://jmespath.org/tutorial.html基本表达式JMESPath用的最多的

    2022年7月30日
    10
  • 【AekdyCoin】求小于等于N的与N互质的数的和

    【AekdyCoin】求小于等于N的与N互质的数的和又向大牛学到了一点。以下内容转大牛文章:ifgcd(n,i)=1thengcd(n,n-i)=1(1反证法:如果存在K!=1使gcd(n,n-i)=k,那么(n-i)%k==0而n%k=0那么必须保证i%k=0k是n的因子,如果i%k=0那么gcd(n,i)=k,矛盾出现;于是问题变的非常简单ANS=N*phi(N)/2i,n-i总是成对

    2022年7月23日
    12
  • java如果智慧小区物业系统,基于ssm\springboot智慧小区物业管理平台实现

    java如果智慧小区物业系统,基于ssm\springboot智慧小区物业管理平台实现手把手实现智慧小区物业平台

    2022年10月17日
    1
  • 宝塔面板配置及部署javaweb教程(全网最全)

    宝塔面板配置及部署javaweb教程(全网最全)配置宝塔面板javaweb运行环境详解1.准备:(解析成功的域名,本地运行完好的项目,宝塔面板)解析按照阿里的教程一步一步来,不会出错,非常简单,有问题的自行百度2.登陆宝塔面板配置环境安装必备软件这里推荐安装Nginxweb服务器,感觉Apache要没落了,安装都是一键式安装,除了图示的软件之外,还需下载phpMyadmin(用来管理数据库,配套下载php5.3)另外,在选择to…

    2022年6月22日
    81
  • 位图(bmp)文件格式分析

    from:https://blog.csdn.net/qingchuwudi/article/details/25785307位图(bmp)文件格式分析作者:深蓝(由博主分享)一、什么是位图计算机能以位图和矢量图格式显示图像。1、位图(Bitmap):图像又称点阵图或光栅图,它使用我们称为像素(象素,Pixel)的一格一格的小点来描述图像。计算机屏幕其实就是一张包含大量像素…

    2022年4月3日
    214
  • Java取整函数的使用

    在开发中,取整操作使用是很普遍的,所以Java在java.lang.Math类中添加了数字取整方法。在java.lang.Math类中主要包括以下几种取整方法。方法 说明 publicstaticdoubleceil(doublea) 返回大于等于参数的最小整数。 publicstaticdoublefloor(doublea) 返回小于等于参…

    2022年4月8日
    48

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号