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


相关推荐

  • java中static归纳总结

    java中static归纳总结在《Java编程思想》P86页有这样一段话:  “static方法就是没有this的方法。在static方法内部不能调用非静态方法,反过来是可以的。而且可以在没有创建任何对象的前提下,仅仅通过类本身来调用static方法。这实际上正是static方法的主要用途。”  这段话虽然只是说明了static方法的特殊之处,但是可以看出static关键字的基本作用,简而言之,一句话来描述就是:  方便在没有…

    2022年7月17日
  • Linux yum安装与卸载

    Linux yum安装与卸载yum安装与卸载背景由于某种原因删了/usr/share中的yum-plugins、yum-cli文件夹,导致了yum命令失效,后发现之后,从其他虚拟机中导入了这两个文件夹,但是还是缺少了配置文件,导致yum命令一直不能使用,从avro,telnet一直忍到了,安装mysql,实在找不到其他的方法了,然后就想到了卸载重装yum.错误如下把错误的原因在网上搜了一下,几乎所有的博客,都指向了不能联网

    2022年5月17日
  • pychram2021.11.3激活【2021免费激活】

    (pychram2021.11.3激活)最近有小伙伴私信我,问我这边有没有免费的intellijIdea的激活码,然后我将全栈君台教程分享给他了。激活成功之后他一直表示感谢,哈哈~https://javaforall.net/100143.htmlIntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,上面是详细链接哦~9ZHR…

    2022年3月28日
  • wlan、wifi、蜂窝、无线局域网的区别「建议收藏」

    wlan、wifi、蜂窝、无线局域网的区别「建议收藏」1、WLAN跟无线局域网是相同概念,WLAN是缩写。2、无线局域网,英文全名:WirelessLocalAreaNetworks;简写为:WLAN。它相当便利的数据传输系统,它利用射频(RadioFrequency;RF)的技术,使用电磁波取代旧式双绞铜线(Coaxial)所构成的局域网络,在空中进行通信连接,使得无线局域网络能利用简单的存取架构让用户透过它,达到信息随身化。3、Wi-Fi,中文名无线保真,是一种可以将个人电脑、手持设备(如iPad、手机)等终端以无线方式互相连接的技术

    2022年7月11日
  • 两个异步ajax实现同步

    两个异步ajax实现同步

    2022年3月7日
  • OpenProcessToken这个函数用法[通俗易懂]

    OpenProcessToken这个函数用法[通俗易懂] GetCurrentProcessID得到当前进程的IDOpenProcessToken得到进程的令牌句柄LookupPrivilegeValue查询进程的权限AdjustTokenPrivileges调整令牌权限要对一个任意进程(包括系统安全进程和服务进程)进行指定了写相关的访问权的OpenProcess操作,只要当前进程具有SeDeDebug权限就可以了。要是一个用户是Admi

    2022年6月25日

发表回复

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

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