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


相关推荐

  • dropdownlist的AutoPostBack属性「建议收藏」

    dropdownlist的AutoPostBack属性「建议收藏」   我最近在做一个教学楼管理系统,老师说最好做成动态网页的形式,反正我也希望自己学习一下有关.net的东西,于是就选择了asp.net,在这之前我学习过mfc,asp所以入门不算太难,甚至在刚刚接触C#的时候还很兴奋,觉得用vc++要写大段代码解决的问题,而用C#几乎一段代码都不用写。所以学习了一周时间我就开始准备动手做教学楼管理系统,在做的过程中遇到了很多的问题,今天上午我准备用母版页的技

    2022年10月16日
    0
  • html css 分页样式,css中分页样式

    html css 分页样式,css中分页样式css中分页样式css分页样式的设置,我们可以采用ul+li来实现,设置li标签float为left,让它们排列在一行,再设置li标签里面的a标签样式。具体实现如下:部分css代码解释#model14ul{padding-inline-start:0!important;/*设置ul的开头距离为零必面设置自动居中时影响美观*/}#model14li:first-child{mar…

    2022年7月17日
    15
  • pyqt ui设计_python pyqt5界面开发

    pyqt ui设计_python pyqt5界面开发@[TOC)欢迎使用Markdown编辑器你好!这是你第一次使用Markdown编辑器所展示的欢迎页。如果你想学习如何使用Markdown编辑器,可以仔细阅读这篇文章,了解一下Markdown的基本语法知识。新的改变我们对Markdown编辑器进行了一些功能拓展与语法支持,除了标准的Markdown编辑器功能,我们增加了如下几点新功能,帮助你用它写博客:全新的界面设计,将会带…

    2022年8月28日
    1
  • Android应用程序绑定服务(bindService)的过程源代码分析

    Android应用程序绑定服务(bindService)的过程源代码分析Android应用程序组件Service与Activity一样,既可以在新的进程中启动,也可以在应用程序进程内部启动;前面我们已经分析了在新的进程中启动Service的过程,本文将要介绍在应用程序内部绑定Service的过程,这是一种在应用程序进程内部启动Service的方法。     在前面一篇文章Android进程间通信(IPC)机制Binder简要介绍和学习计划中,我们就曾经提到,在A

    2022年9月18日
    0
  • 反掩码与通配符掩码[通俗易懂]

    反掩码与通配符掩码[通俗易懂]掩码我们学数通的应该都很熟悉,我们刚刚学习IP的时候肯定都学过,这里就不在叙述。今天我们要说的是反掩码和通配符掩码,反掩码相信大家也都不陌生,我们配置OSPF的时候都能用的到但是很多网工也就知道配置OSPF就要那么配置,用255.255.255.255减去正掩码就是反掩码,但是反掩码是啥却说不出来。反掩码掩码顾名思义就是正掩码反过来,正掩码是连续的1和0构成,用来…

    2022年7月24日
    7
  • uat测试环境是预生产环境_php开发环境与测试环境

    uat测试环境是预生产环境_php开发环境与测试环境开发环境:开发环境是程序猿们专门用于开发的服务器,配置可以比较随意,为了开发调试方便,一般打开全部错误报告。测试环境:一般是克隆一份生产环境的配置,一个程序在测试环境工作不正常,那么肯定不能把它发布到生产机上。生产环境:是指正式提供对外服务的,一般会关掉错误报告,打开错误日志。可以理解为包含所有的功能的环境,任何项目所使用的环境都以这个为基础,然后根据客户的个性化需求来做调整或者

    2022年9月30日
    0

发表回复

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

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