当前位置:网站首页>The interviewer with ByteDance threw me an interview question and said that if I could answer it, other companies would have an 80% chance of passing the technical level
The interviewer with ByteDance threw me an interview question and said that if I could answer it, other companies would have an 80% chance of passing the technical level
2022-06-26 06:02:00 【Interview with Java factory】
Hello everyone , I am a Java Big factory interview you .
Yes , No mistake. , Years ago, I went to byte for an interview !
Let's share an interview episode
interviewer :“ Are you married? ?”
I :“ No, ”
interviewer :“ I don't have ”
Get down to business , I won't talk about the specific resume writing and interview process , A lot of people share .
After the meeting, ask me when I can be on duty , I said to think about it again .
This interview can be described as from java Basic grammar 、JVM、 Multithreading to MySQL、spring、springboot、springcloud, There's more dubbo、mybatis、redis、 The bottom of the network IO、Linux、MQ、zookeeper、netty、 big data 、 Data structure and algorithm 、 And then to design patterns and so on .
After all, we are technical , What questions did you ask during the interview .
Question 1 :CMS、G1 Three in the garbage collector ⾊ Mark do you understand ?
3、 ... and ⾊ The notation is ⼀ A waste recycling method , It can make JVM No hair ⽣ Or just for a short time ⽣ STW(Stop TheWorld), from ⽽ reach
To clear JVM Memory garbage ⽬ Of .
3、 ... and ⾊ The notation marks the face of the object ⾊ Divided into ⿊、 ash 、⽩, Three colors ⾊.
⿊⾊: The object has been marked , And all the attributes under the object have been marked ;
ash ⾊: The object has been scanned by the garbage collector , But there are still references in the object that have not been scanned ⽤ ;
⽩⾊: Indicates that the object has not been accessed by the garbage collector , I.e. not reachable ;
3、 ... and ⾊ Missing mark problem of marking 
Question two : If CPU send ⽤ The rate suddenly soared , How would you check ?
1、 Through the first top Command found consumption cpu very ⾼ The process of id( The assumption is 2732)
top The order is that we are Linux Most often ⽤ Of the orders of ⼀, It can display the execution in real time ⾏ Process CPU send ⽤ rate 、 Memory makes ⽤ Rate and system load . The upper part shows the statistical information of the system , The lower part shows the process of making ⽤ Rate statistics .
2、 Of board ⾏top -p 2732 Monitor the process separately
3、 In the 2 Step monitoring community ⾯ transport ⼊H, Get all thread information under the current process 
4、 Find the consumption cpu special ⾼ Thread number ( The assumption is 2734)
5、 Of board ⾏jstack 2732 Make changes to the current process dump, Output all thread information
At the same time, the 4 The thread obtained in step ⼗ Hexadecimal number 2734 Turn into 16 Base number (AAE), In the stack information ⾥⾯ Find the corresponding thread content 
6、 Finally, read the thread information , Locate the specific code location
How are you seeing here ?
Question 3 : Please outline AQS
yes ⽤ To build the basic framework for locks or other synchronous components ,⽐ Such as ReentrantLock、ReentrantReadWriteLock and
CountDownLatch Is based on AQS Realized . It makes ⽤ 了 ⼀ individual int The member variable represents the synchronization state , Through the built-in
FIFO Queue to complete the queue of the resource acquisition thread ⼯ do . It is CLH Queue lock ⼀ Two variants implement . It can achieve 2 Same species
Step ⽅ type : exclusive , Shared .
AQS The main cause of ⽤⽅ Formula is inheritance ,⼦ Class by inheritance AQS And implement its abstraction ⽅ Method to manage synchronization status , Synchronizer's
Design is based on templates ⽅ Law mode , So if we want to achieve ⾃⼰ Synchronization of ⼯ Classes need to be overridden ⼏ A rewritable ⽅
Law , Such as tryAcquire、tryReleaseShared wait .
Designed like this ⽬ Is the synchronization component (⽐ Like a lock ) yes ⾯ To make ⽤ Of , It defines to make ⽤ The interface between the user and the synchronization component ⼝
(⽐ For example, two threads can be allowed to work together ⾏ visit ), Hidden implementation details ; synchronizer ⾯ To the lock implementer , It simplifies
Lock implementation ⽅ type , The synchronization state management is blocked 、 Thread queuing 、 Wait and wake up and other underlying operations . This is a good way to isolate
Made ⽤ Areas of concern for developers and implementers .
In the internal ,AQS maintain ⼀ Shared resources state, Through the built-in FIFO To complete the queuing of the thread to obtain resources ⼯ do . This queue
from ⼀ individual ⼀ One of the Node Node composition , Every Node Node maintenance ⼀ individual prev lead ⽤ and next lead ⽤, Point to respectively ⾃⼰ Before
Drive and successor nodes , constitute ⼀ Two end two-way linked list .
At the same time Condition Related waiting queues , The node type is also Node, constitute ⼀ A one-way list .
Question 4 :InnoDB⼀ Tree B+ How much can a tree hold ⾏ data ?
The problem is actually ⾮ Often simple : about 2 Ten million
When a computer stores data , Have the most ⼩ Storage unit , In a computer, disk storage is the most ⼩ A unit is a sector ( That's good ⽐ We today
Tianjin ⾏ present ⾦ The circulation of ⼩ The unit is ⼀⽑),⼀ It's a sector ⼤⼩ yes 512 byte ,⽽⽂ Piece system ( for example XFS/EXT4) The most
⼩ A unit is a block ,⼀ Block ⼤⼩ yes 4k,⽽ For our InnoDB Storage engines also have ⾃⼰ The most ⼩ Storage unit ——⻚
(Page),⼀ individual ⻚ Of ⼤⼩ yes 16K.
Innodb All data for ⽂ Pieces of ( The suffix is ibd Of ⽂ Pieces of ), His ⼤⼩ It's always 16384(16k) Integer multiple .
The data in the data table is stored in ⻚ Medium , therefore ⼀ individual ⻚ How much can be stored in ⾏ Data? ? hypothesis ⼀⾏ Data ⼤⼩ yes 1k, that
Well ⼀ individual ⻚ It can store 16 ⾏ Data like this .
about B+ Trees ⽽⾔, Only leaves ⼦ Nodes store data ,⾮ leaf ⼦ The node stores only the index information and the following information ⼀ The pointer letter of the layer node
Rest .⼀ individual ⾮ leaf ⼦ How many pointers can a node store ?
In fact, this is also very good , Let's assume that the primary key ID As usual ⽤ Of bigint type ,⻓ Degree is 8 byte ,⽽ The pointer ⼤⼩ stay InnoDB Source code
Set to 6 byte , such ⼀ common 14 byte , We ⼀ individual ⻚ How many such units can be stored in , In fact, it means how many hands there are , namely
16384/14=1170 individual .
Then we can work out ⼀ Tree ⾼ Degree is 2 Of B+ Trees , There is ⼀ A root node and if ⼲ Leaves ⼦ Nodes can store 117016=18720 This way
Data record of .
According to the same principle, we can calculate ⼀ individual ⾼ Degree is 3 Of B+ Trees can store : 11701170*16=21902400 A note like this
record .
Can you answer these questions ?

One 、ActiveMQ What to do if the server goes down ?
Two 、JDK Dynamic proxy sum CGLIB Dynamic proxy differences ?
3、 ... and 、Redis The most appropriate scene ?
Friends who can see here must be interested in interviewing big factories , Or those who are learning to prepare for a big noodle factory , The notes range from introductory to advanced to advanced and practical cases , It can be said to be perfect .

give the thumbs-up All of my little friends finally got their favorite big factory offer Oh ༻ི( ᵒ̶̷ᵕ ᵒ̷̶)༄୭*ˈ
边栏推荐
- A love that never leaves
- "= =" difference from "equals"
- Easy to understand from the IDE, and then talk about the applet IDE
- numpy. exp()
- Cython入门
- one billion two hundred and twelve million three hundred and twelve thousand three hundred and twenty-one
- Kolla ansible deploy openstack Yoga version
- Sql语法中循环的使用
- 力扣 875. 爱吃香蕉的珂珂
- Implement the runnable interface
猜你喜欢

Redis多线程与ACL

原型模式,咩咩乱叫

Adapter mode

Selective Search for Object Recognition 论文笔记【图片目标分割】

Younger sister Juan takes you to learn JDBC -- two days' Sprint Day2

423-二叉树(110. 平衡二叉树、257. 二叉树的所有路径、100. 相同的树、404. 左叶子之和)

操作符的优先级、结合性、是否控制求值顺序【详解】

Status mode, body can change at will

工厂方法模式、抽象工厂模式

On site commissioning - final method of kb4474419 for win7 x64 installation and vs2017 flash back
随机推荐
421-二叉树(226. 翻转二叉树、101. 对称二叉树、104.二叉树的最大深度、222.完全二叉树的节点个数)
COW读写复制机制在Linux,Redis ,文件系统中的应用
5 minutes to learn regular expressions
Day3 - variables and operators
pytorch(环境、tensorboard、transforms、torchvision、dataloader)
【群内问题学期汇总】初学者的部分参考问题
5分钟包你学会正则表达式
numpy. tile()
Sql语法中循环的使用
SSH keygen specifies the path
类和对象的学习
05. basic data type - Dict
Old love letters
Customize WebService as a proxy to solve the problem of Silverlight calling WebService across domains
Upgrading technology to art
冒泡排序(Bubble Sort)
Adapter mode
Level signal and differential signal
组合模式、透明方式和安全方式
Class and object learning