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

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

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

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

  • 磁力链接文件服务器,什么是磁力链接(BT、磁力链这些词语是什么意思?)

    磁力链接文件服务器,什么是磁力链接(BT、磁力链这些词语是什么意思?)“知其然知其所以然”。我们经常在下载资料的时候能看到BT、磁力链等词语,百思特网这些词语到底是什么意思呢?下载都会用,但是你了解吗?BT下载传统的下载模式是每个客户端从服务器拷贝文件,跟校园内常用的FTP一样。因为服务器宽带是一定的,所以下载的人越多下载速度会越慢。而现在使用的下载器情况正好相反,使用的人越多文件下载速度越快。这是因为现在的下载器普遍采用类似BT的下载方式。布拉姆科恩发明了BT协议…

  • Mac新手使用技巧——Mac如何强制关机

    Mac新手使用技巧——Mac如何强制关机一般情况下,Mac电脑是非常稳定的,但是偶尔也会碰到应用程序没有响应或死机的情况,那么我们需要强制关机,Mac如何强制关机呢?一起来看看吧!1.如果是电脑打开了太多的应用程序造成了没有响应,可以按Command+Q来强制退出。2.如果还是没有反应,很多人喜欢像windows电脑那样按电源键5秒进行强制关机。(这其实是有损坏系统文件的风险)3.如果要采用这种强制切断电源的方法,最好是同时按住control+command+电源键,这样也可以强制关闭电脑,并且不会损坏系统。4.一般关机都是点

  • android studio报错Gradle project sync failed. Please fix your project and try again

    android studio报错Gradle project sync failed. Please fix your project and try againAndroidStudio导入项目或者新建项目想运行的时候可能会报错Gradleprojectsyncfailed.Pleasefixyourprojectandtryagain,原因应该是Gradle的一些东西没配好。这2个版本必须要保证本地有,而且一定要对得上。怎么知道本地有没有,下面2张图片展示他们各自的路径。(默认路径在安装AndroidS…

  • Entity Framework

    Entity Framework

  • 外贸服务云服务好“一带一路”[通俗易懂]

    外贸服务云服务好“一带一路”

  • 身体健康比啥都重要

    身体健康比啥都重要

发表回复

您的电子邮箱地址不会被公开。

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