乐观锁和悲观锁的不同场景
时间: 2023-10-13 20:03:00 浏览: 93
乐观锁和悲观锁在使用场景上有一些不同。乐观锁适用于并发读取操作多于写入操作的场景,它假设在并发操作中很少会发生冲突,因此不会加锁,而是通过比较数据版本号或使用CAS(Compare and Swap)操作来实现数据一致性的控制。乐观锁在多读少写的情况下可以提高性能。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [【航母特辑】06_乐观锁和悲观锁的业务场景以及使用案例,这篇很全](https://blog.csdn.net/qq1437722579/article/details/123681557)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [乐观锁和悲观锁各自应用场景](https://blog.csdn.net/Candyz7/article/details/126517806)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文