Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post1$ hexo new "My New Post"
More info: Writing
Run server1$ hexo server
More info: Server
Generate static files1$ hexo generate
More info: Generating
Deploy to remote sites1$ hexo deploy
More info: Deployment
来源:Java 看看这些秋招可能会问的高频八股你能说得上来多少吧
常见八股文汇总并发什么是乐观锁?什么是悲观锁?
乐观锁:假设并发操作时不会冲突,只在数据更新时加锁;
适用于读多写少场景,提高了并发性能,但存在版本号回滚问题(ABA)
悲观锁:假设并发操作时会冲突,先加锁再操作(如 Synchronized、ReentrantLock)。
适用于读多写少、安全性要求更高的场景,数据一致性高
CAS 是怎么实现的?
“比较并交换”,通过 CPU 原子指令实现:先比较内存值与预期值,一致则更新为新值,否则失败(需重试)。
Synchronized 和 ReentrantLock 有什么区别?
特性
Synchronized
ReentrantLock
实现
JVM 关键字
Java 类
加解锁
自动
手动 lock/unlock
功能
基础加锁
支持中断、公平锁、条件变量
[!question] 为什么使用synchronized而不是ReentrantLock
性能考量:Java 8优化后的synchronized在单bucket竞争 ...




