• 请不要在回答技术问题时复制粘贴 AI 生成的内容
brucefeng
V2EX  ›  程序员

分享——乐观锁(Optimistic Locking)与悲观锁(Pessimistic Locking)

  •  
  •   brucefeng ·
    brucefengnju · Dec 18, 2015 · 3334 views
    This topic created in 3979 days ago, the information mentioned may be changed or developed.
    4 replies  •  2015-12-19 11:18:52 +08:00
    slixurd
    slixurd
    Dec 18, 2015❤️1
    1
    本质上乐观锁就是一个 CAS 。
    感觉写的稍微有点入门.....而且还没讲 2PL 之类的东西
    另外还有一些解决锁的性能的改进,比如 MVCC ,主流 DB 都支持
    brucefeng
    brucefeng
    OP
    Dec 18, 2015
    2
    @slixurd 嗯,锁性能的改进我自己还没用到过,正好可以深入研究下
    brucefeng
    brucefeng
    OP
    Dec 18, 2015
    3
    @slixurd 哈哈,每次在这上面分享都有新的收获。
    gejun123456
    gejun123456
    Dec 19, 2015 via Android
    4
    乐观锁给个例子呗
    如 select version from a
    update sme row where version =?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1033 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:47 · PVG 06:47 · LAX 14:47 · JFK 17:47
    ♥ Do have faith in what you're doing.