登录

立即登录

去注册

忘记密码?

验证码登录

点击获取验证码

立即登录

去注册

注册

点击获取验证码

立即注册

找回密码

点击获取验证码

确定

全部资讯

全部资讯   / 字节抖音Java一二面

字节抖音Java一二面

2021-12-24 11:41:29

<h1 style="margin: 0pt 0pt 20pt; font-family: 宋体; font-weight: bold; font-size: 24pt; color: rgb(0, 0, 0); text-indent: 0pt; padding: 0pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><b style="font-size: 13.5pt; text-indent: 0pt;"><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">&nbsp;</span></b><b style="font-size: 13.5pt; text-indent: 0pt;"><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">一面</span></b><br></h1><p class="p" style="margin: 12pt 0pt; font-family: Calibri; font-size: 12pt; text-indent: 0pt; padding: 0pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">1.Java如何实现线程安全(synchronized,ReentrantLock,AtomicInteger,ThreadLocal,CAS)</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">2.CAS如何解决ABA问题(版本号)</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">3.AtomicInteger的原理(UnSafe类,底层是一句CPU指令,避免了并发问题)</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">4.可重入锁是什么,非可重入锁又是什么(略</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">5.代码,实现生产者和消费者,一个长度100的buffer,10个生产者线程,10个消费者线程</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system"><span style="font-size: 12px;">(我用了</span></font><span style="font-size: 12px;">ReentrantLock跟Condition,结果忘记了锁的包路径是啥了,我写成了java.util.concurrent.</span></span><i><span class="16" style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system"><span style="font-size: 12px;">,后来才知道是</span></font><span style="font-size: 12px;">java.util.concurrent.locks.</span></span></i><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">。。。)</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">6.对着代码提问,判定条件的while能不能换成if,为什么?为什么用signalAll,可不可以换成signal,二者有什么区别?</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">7.Spring,AOP是什么,IOC是什么</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">8.</span><a href="https://www.nowcoder.com/jump/super-jump/word?word=%E4%BA%8C%E5%8F%89%E6%A0%91"><u><span class="15" style="font-family: system; color: rgb(153, 153, 153); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system">二叉树</font></span></u></a><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">的概念?</span><a href="https://www.nowcoder.com/jump/super-jump/word?word=%E7%BA%A2%E9%BB%91%E6%A0%91"><u><span class="15" style="font-family: system; color: rgb(153, 153, 153); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system">红黑树</font></span></u></a><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">又是什么,</span><a href="https://www.nowcoder.com/jump/super-jump/word?word=%E7%BA%A2%E9%BB%91%E6%A0%91"><u><span class="15" style="font-family: system; color: rgb(153, 153, 153); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system">红黑树</font></span></u></a><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">和其他平衡树的区别在哪</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">9.TCP三次握手的过程,重发报文的过程。</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">10.TCP和UDP的区别</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">11.说一下哪个</span><a href="https://www.nowcoder.com/jump/super-jump/word?word=%E9%A1%B9%E7%9B%AE"><u><span class="15" style="font-family: system; color: rgb(153, 153, 153); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system">项目</font></span></u></a><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">觉得最有挑战,有几个模块,介绍一下</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">12.代码,LeetCode76</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt;"><o:p></o:p></span></p><h3 style="margin: 24pt 0pt 16pt; font-family: 宋体; font-weight: bold; font-size: 13.5pt; color: rgb(0, 0, 0); text-indent: 0pt; padding: 0pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><b><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">二面</span></b><b><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 13pt;"><o:p></o:p></span></b></h3><p class="p" style="margin: 12pt 0pt; font-family: Calibri; font-size: 12pt; text-indent: 0pt; padding: 0pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">1.MySQL的事务特性,事务隔离级别,分别解决了什么问题</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">2.间隙锁是什么,具体什么时候会加锁(具体什么时候加锁,这里要把所有情况都说清楚。。</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">3.SQLite如何加锁</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">4.Java里的锁,有哪几种(synchronized和Reentrantlock)</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">5.ReentrantLock有哪些特性(可重入,公平锁),可重入是如何实现的(有一个引用数,非可重入只有01值)</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">6.当某个线程获取ReentrantLock失败时,是否会从内核态切换回用户态?ReentrantLock如何存储阻塞的线程的?(AQS,不断轮询前一个结点是否状态发生了变化)所以什么是自旋锁?</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">7.JVM,说一下最熟悉的GC(我说了CMS,讲了并行回收,浮动垃圾,最短STW等等),然后追问我CMS的整个回收流程,标记,清理等等,年轻代怎么回收等等。(被问倒了。</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">7.Redis的持久化如何做到的?(RDB+AOF)</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">8.RDB具体是如何实现的,RDB生成快照的时候,Redis会阻塞掉吗?(使用BgSave,fork一个子进程去并行生成快照,不会阻塞)</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">9.既然生成快照的中途依然可以执行Redis,那么从节点获取到快照是不完整的,如何同步?(主从同步,先建立连接,然后命令传播,两个结点中的buffer队列里存储一个offset,差值就是需要同步的值)</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">10.设计题,设计一个扫码登陆(不会)那换成设计微信红包功能(MySQL的字段,Redis缓存一致性,发红包如何add字段,抢红包如何修改字段,通过一个唯一的版本号去保证CAS的ABA得到解决。但说了很久,面试官依然认为思路混乱)</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">11.</span><a href="https://www.nowcoder.com/jump/super-jump/word?word=%E7%AE%97%E6%B3%95%E9%A2%98"><u><span class="15" style="font-family: system; color: rgb(153, 153, 153); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system">算法题</font></span></u></a><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system"><span style="font-size: 12px;">,</span></font><span style="font-size: 12px;">n*n的矩阵,只能向右或向下移动,从最左上方移动到</span></span><a href="https://www.nowcoder.com/jump/super-jump/word?word=%E6%9C%80%E5%8F%B3"><u><span class="15" style="font-family: system; color: rgb(153, 153, 153); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system">最右</font></span></u></a><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">下方,把所有的路径输出(回溯,但剪枝忘了。前面的也答得不好,差不多就溜溜球了,也没有继续挣扎了。。)</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt;"><o:p></o:p></span></p><p class="p" style="margin: 12pt 0pt; font-family: Calibri; font-size: 12pt; text-indent: 0pt; padding: 0pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px;">&nbsp;</span></p><p class="p" style="margin: 12pt 0pt; font-family: Calibri; font-size: 12pt; text-indent: 0pt; padding: 0pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 12px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">总结:</span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system"><span style="font-size: 12px;">二面真的太难了,每一个问题都会一直细问,追问。其实</span></font><span style="font-size: 12px;">ReentrantLock,还有MySQL的锁,Redis的持久化过程,我都有认真去复习的,但真的追问得太细了。。其实当时他第一题问“MySQL具体什么时候加锁”,我就挺懵的了。因为这个题我确实研究过很久,要综合考虑隔离级别,是否用了主键索引,二级索引,是否 存在回表等等的。所以当时我也不知道怎么回答,然后冷静下来就定位到了间隙锁上也就是肯定为RR级别,接着把大概的select,insert,delete等等的都说了,但后面还要继续说更细节的情况。我也不知道是我对题目的理解有问题,还是面试官想要的答案跟我不一致。反正挫败感很强,因为我记得当时看“这条SQL语句加了什么锁”,真的看了很久,而且自己也动手去测试了,结果还是没能满足面试官。。</span></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt;"><o:p></o:p></span></p><p class="p" style="margin: 12pt 0pt; font-family: Calibri; font-size: 12pt; text-indent: 0pt; padding: 0pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system"><span style="font-size: 12px;">面试官看我对锁的理解</span></font><span style="font-size: 12px;">“不够深入”,于是转向了Java里的锁。问完ReentrantLock的特性,又问什么是可重入锁,说完又问具体是怎么实现的。直到这里我还是完全OK的,但后面的“线程在用户态和内核态的切换”我就完全不懂了,面试官诱导了一下ReentrantLock如何实现,我大概说了一下AQS跟CLH锁,感觉又被挖坑了,跟前面说的“可能答案”自相矛盾。。</span></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt;"><o:p></o:p></span></p><p class="p" style="margin: 12pt 0pt; font-family: Calibri; font-size: 12pt; text-indent: 0pt; padding: 0pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><font face="system"><span style="font-size: 12px;">接着的</span></font><span style="font-size: 12px;">Redis持久化,也追问得很厉害,从持久化问到主从同步。。中间追问的时候描述得也比较“模糊”,后来在提示下才知道是问主从同步了,然后把整个过程都说了一下。。</span></span><span style="font-family: system; color: rgb(51, 51, 51); letter-spacing: 0pt; font-size: 14pt;"><o:p></o:p></span></p><p class="MsoNormal" style="margin: 0pt 0pt 20pt; font-family: Calibri; font-size: 10.5pt;"><span style="font-family: 宋体; font-size: 12px;">&nbsp;</span></p><p class="MsoNormal" style="margin: 0pt 0pt 20pt; font-family: Calibri; font-size: 10.5pt;"><span style="font-size: 12px;">&nbsp;</span></p><p class="MsoNormal" style="margin: 0pt 0pt 0.0001pt; font-family: Calibri; font-size: 10.5pt;"><span style="font-size: 12px;">&nbsp;</span></p><p class="MsoNormal" style="margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: Calibri; font-size: 10.5pt;"><span style="font-size: 12px;">&nbsp;</span></p>

上一篇 下一篇

热门资讯