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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • mysql workbench如何导入数据库_sql数据库脚本导入

    mysql workbench如何导入数据库_sql数据库脚本导入首先,打开MySQLworkbench,先新建数据库(我们会把.sql文件导入之这个数据库),新建数据库过程如下:先点击1处,新建数据库,给数据库起个名字,点击appy,就创建成功了。之后点击2处,就可以看到现有的数据库了。这里圈出来的是我新建的数据库,双击选中这个数据库(双击选中很重要,因为选中之后才能将.sql文件导入这个数据库中)。然后点击左上方的第二个图标(图中圈出来的那…

    2022年10月2日
    4
  • 空间相关分析(三) 局部莫兰指数的理解与计算「建议收藏」

    空间相关分析(三) 局部莫兰指数的理解与计算「建议收藏」        在上篇中,我们详细地阐述了全局莫兰指数(GlobalMoran’I)的含义以及具体的软件实操方法。今天,就来进一步地说明局部莫兰指数(LocalMoran’I)的含义与计算。        首先说明一下进行局部相关分析的必要性:在全局相关分析中,如果全局莫兰指数显著,我们即可认为在该区域上存在空间相关性。但是,我们还是不知道

    2022年6月25日
    105
  • LR模型推导_索洛模型的简单推导

    LR模型推导_索洛模型的简单推导概念 逻辑回归假设数据服从伯努利分布,通过极大化似然函数方法,运用梯度下降来求解参数,来达到将数据二分目的 sigmoid函数 sigmoid函数:,y为正样本的概率,1-y为负样本的概率 LR模型推导 设 另 那么对应 极大似然估计 似然函数 对数似然函数就是 将代入公式 对参数求偏导 参数更新 …

    2022年10月13日
    3
  • 【视频教程】JEECG 入门视频教程大全+历史版本号代码下载[通俗易懂]

    【视频教程】JEECG 入门视频教程大全+历史版本号代码下载

    2022年1月27日
    41
  • 基于近邻的协同过滤算法

    基于近邻的协同过滤算法这节课我们来学习K近邻在推荐系统中的应用,你将完成本课程的第一个实战项目:基于KNN的电影推荐系统!为了使你能够顺利地完成实战内容,我们先了解一下推荐系统中的基础知识。基于近邻用户的协同过滤假定有一个场景:某个周日的下午,你感觉很无聊,然后从电脑上打开了一个视频网站,想看下最近有什么好看的电影。然而你发现网站上的热门电影基本都看过,其他的电影又太多,不知道该看什么。想使用搜索框去查一下,但是又不知道该搜什么关键词,这个时候你的内心很焦灼,总不能挨个去尝试吧,那时间成本也太大了…仔细想想还是有办法的,那

    2022年6月30日
    27
  • phpstrom激活码2021_在线激活

    (phpstrom激活码2021)JetBrains旗下有多款编译器工具(如:IntelliJ、WebStorm、PyCharm等)在各编程领域几乎都占据了垄断地位。建立在开源IntelliJ平台之上,过去15年以来,JetBrains一直在不断发展和完善这个平台。这个平台可以针对您的开发工作流进行微调并且能够提供…

    2022年3月28日
    85

发表回复

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

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