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

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

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