当前位置:网站首页>What happened to the JVM locking on Tencent ECS?
What happened to the JVM locking on Tencent ECS?
2022-06-24 05:41:00 【User 8639654】
One Why do you say this ?
summary AQS after , By the way, let's review this aspect . This paper starts from the following high frequency problems :
- What is the memory layout of objects in memory ?
- describe synchronized and ReentrantLock The underlying implementation of and the underlying principle of reentry .
- Talk about AQS, Why? AQS The bottom is CAS+volatile?
- Describe the four states of the next lock and the lock upgrade process ?
- Object o = new Object() How many bytes does it take up in memory ?
- Is spin lock necessarily more efficient than heavyweight lock ?
- Whether the efficiency of opening the deflection lock will definitely be improved ?
- What's the weight of a heavyweight lock ?
- When is a heavyweight lock more efficient than a lightweight lock , And vice versa ?
Two What happened to locking ?
The unconscious use of locks :
//System.out.println They're all locked
public void println(String x) {
synchronized (this) {
print(x);
newLine();
}
}
What happens to simple locking ?
To find out what happens after locking, you need to look at the layout in memory after the object is created ?
An object is in new After coming out, it is mainly divided into 4 Parts of :
markword This part is actually the core of locking , It also contains some life information of the object , For example, whether GC、 After several times Young GC Still alive .
klass pointer It records the... That points to the object class The file pointer .
instance data Record the variable data in the object .
padding Use as alignment , The object is 64 Bit server version , Specifies that object memory must be able to be 8 Byte Division , If it's not divisible , Then rely on the right Qi Laibu . for instance :new I have an object , Memory only takes up 18 byte , But the rules have to be able to be 8 to be divisible by , therefore padding=6.
public class JOLDemo {
private static Object o;
public static void main(String[] args) {
o = new Object();
synchronized (o){
System.out.println(ClassLayout.parseInstance(o).toPrintable());
}
}
}边栏推荐
- Where does the website domain name buy a normal domain name? What is the approximate price
- How to register a company domain name how to build a website with a domain name
- When we talk about zero trust, what are we talking about?
- Netaapp data recovery process
- Distributed background task load balancing
- How to build a website after successfully registering a domain name? Can I build a website without registering a domain name?
- How to register a first level domain name what is a first level domain name
- Micro build low code supports PC application construction
- "Adobe international certified" graphic designer! How to break through the creative barrier and gain both fame and wealth?
- Oceanus practice - use of the Nepal graph connector in the graph database
猜你喜欢

How should we learn cloud native in 2022?
What cloud native knowledge should programmers master?
Easy to understand JDBC tutorial - absolutely suitable for zero Foundation
Learning routes and materials for cloud native O & M engineers

Answer questions! This article explains the automated testing framework in software testing from beginning to end
随机推荐
Netaapp data recovery process
Bert series Roberta Albert erine detailed explanation and use learning notes
The personal information protection law was passed today. What problems should enterprises pay attention to?
Talk about team management: how to build your own management system!
test
How to resolve Chinese domain names? What is domain name resolution?
How to buy a domain name? What should I pay attention to when buying a domain name?
Youtech sharing | the application of Tencent Youtu multimodal graphic content identification and positioning in content security
How do virtual hosts bind domain names? Can binding failure be used normally?
Wang Wei, senior architect of coding Devops, was selected as the first batch of tutors in Mulan open source community
The 2021 smart Expo is about to open. Tencent Youtu and "Ai Gallery" will "Chongqing" with you
Why storage?
Tamp the foundation, step into the cloud and rise to the original cloud Devops
How to apply for a website domain name and what problems should be paid attention to
What should I pay attention to in server hosting and migration?
How to get the website domain name? Does it cost money to apply for a website domain name?
What domain name is cheap? How much does it cost to register a domain name?
PV and PVC analysis and use in kubernetes
Resourcequota for detailed explanation of kubernetes resource constraints
Supply chain innovation of industrial Internet -- supply chain +5g Technology