Merged
Conversation
- java-concurrent-questions-02.md: 新增volatile内存屏障类型、读写屏障插入策略、DCL内存屏障分析、volatile与happens-before关系、volatile与synchronized性能对比 - aqs.md: 新增独占模式与共享模式深入对比、Condition条件队列工作机制及源码分析、公平锁与非公平锁性能差异分析
Owner
感谢完善,很实用的补充👍欢迎加我的微信领取一个小红包:javaguide1024 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
添加了一些在我秋招春招面试过程中,遇到的一些被问住的问题,以及在其他地方看到的,可以和面试官展示深度的问题,比如非常常见(尤其是字节)会问的AQS相关的东西。
以下是新增的列表:
AQS章节里
ThreadLocal章节:
原文已经讲了 key 是弱引用、value 是强引用的基本机制,但没解释为什么要用弱引用——这次把完整的引用链路画出来了,对比了如果 key 用强引用会怎样,弱引用本质上是个兜底机制但也不完全可靠。
然后专门讲了线程池场景下的风险放大效应,引了美团技术团队那个用户数据串号的真实事故。最后把阿里巴巴 Java 开发手册里那条【强制】规则原文贴上来了,给了 static final + try-finally + remove() 的标准写法,解释了为什么要用完就清而不是下次用之前再 set。
备注:为了语言的严谨性,使用大模型进行了润色,然后进行人工修改增强可读性,如有错误请指正!