当前位置:网站首页>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 ༻ི( ᵒ̶̷ᵕ ᵒ̷̶)༄୭*ˈ
边栏推荐
- Written before father's Day
- String类学习
- 电商借助小程序技术发力寻找增长突破口
- Overloading and overriding
- 5 minutes to learn regular expressions
- Mysql-10 (key)
- Machine learning 07: Interpretation of PCA and its sklearn source code
- Redis多线程与ACL
- Tencent WXG internship experience (has offered), I hope it will help you!
- Func < T, tresult > Commission - learning record
猜你喜欢

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

Cython入门
![Selective search for object recognition paper notes [image object segmentation]](/img/cf/d3b08d41083f37c164b26a96b989c9.png)
Selective search for object recognition paper notes [image object segmentation]

String class learning

Redis底层数据结构

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

Implementation of third-party wechat authorized login for applet

Keepalived to achieve high service availability

Household accounting procedures (First Edition)

String类学习
随机推荐
numpy.tile()
COW读写复制机制在Linux,Redis ,文件系统中的应用
Sql语法中循环的使用
Getting to know concurrency problems
C generic speed
Spark source code analysis (I): RDD collection data - partition data allocation
Status mode, body can change at will
Overloading and overriding
Soft power and hard power in program development
Application of cow read / write replication mechanism in Linux, redis and file systems
Selective search for object recognition paper notes [image object segmentation]
Selective Search for Object Recognition 论文笔记【图片目标分割】
The model defined (modified) in pytoch loads some required pre training model parameters and freezes them
421- binary tree (226. reversed binary tree, 101. symmetric binary tree, 104. maximum depth of binary tree, 222. number of nodes of complete binary tree)
Thread status and stop
Yamaha robot splits visual strings
Household accounting procedures (the second edition includes a cycle)
String class learning
Machine learning 05: nonlinear support vector machines
kolla-ansible部署openstack yoga版本