In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "what are the test questions for the latest version of JVM in 2021". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Under what circumstances will stack memory overflow occur.
two。 Detailed explanation of JVM memory model
Idea: draw a JVM memory model for the interviewer and describe the definition, function, and possible problems of each module, such as stack overflow.
My answer:
JVM memory structure
Why should 3.JVM memory be divided into new generation, old generation, and persistent generation. Why should it be divided into Eden and Survivor in the new generation?
4. What is a complete GC process in JVM, and how can the object be promoted to the old age?
5. You know which kinds of garbage collectors, their advantages and disadvantages, focus on cms and G1, including the principle, process, advantages and disadvantages.
How much do you know about 6.JVM memory model, such as reordering, memory barrier, happen-before, main memory, working memory.
Idea: first draw the Java memory model diagram, combined with the example volatile, explain what is reordering, memory barrier, it is best to write the following demo instructions to the interviewer.
My answer:
1) Java memory model diagram:
The Java memory model stipulates that all variables are stored in the main memory, and each thread has its own working memory. The working memory of the thread keeps a copy of the main memory copy of the variables used in the thread. All the operations of the thread on the variables must be carried out in the working memory, and can not read or write the main memory directly. There is no direct access to variables in each other's working memory between different threads, and the transfer of variables between threads requires data synchronization between their own working memory and main memory.
2) instruction reordering.
Here, take a look at a piece of code.
Public class PossibleReordering {static int x = 0, y = 0; static int a = 0, b = 0; public static void main (String [] args) throws InterruptedException {Thread one = new Thread (new Runnable () {public void run () {a = 1; x = b;}}); Thread other = new Thread (new Runnable () {public void run () {b = 1; y = a;}}); one.start (); other.start (); one.join (); other.join () System.out.println ("(" + x + "," + y + "));}
The running result may be (1), (0), (0) or (1), or (0). Because, in the actual run time, the code instructions may not be executed in strict order according to the code statements. Most modern microprocessors will use the method of out-of-order execution instruction execution (OoOE or OOE). When conditions permit, they will directly run subsequent instructions that currently have the ability to execute immediately, avoiding the wait caused by getting the data needed for the next instruction. Through the technology of out-of-order execution, the processor can greatly improve the execution efficiency. And this is
Command rearrangement.
7. Tell me briefly about the class loader you know, can you break the parent delegation, and how to break it.
Parent delegation model diagram:
8. Tell me about the main JVM parameters you know.
9. How to type out thread stack information.
10. What is the difference between strong reference, soft reference, weak reference and virtual reference?
11. Memory model and partitions need to be detailed about what to put in each area.
twelve。 Partition in the heap: Eden,survival (from+ to), old age, their own characteristics.
13. Briefly describe the garbage collection mechanism of java?
What are the methods of garbage collection in 14.java?
15.java memory model
16.java class loading process?
[failed to upload picture... (image-1724a6-1618753895697)]
17. Briefly describe the java class loading mechanism?
The virtual machine loads the data describing the class from the Class file into memory, and verifies, parses and initializes the data, and finally forms the java type that can be directly used by the virtual machine.
18. Parent delegate model mechanism for class loaders?
When a class receives a class load request, it will not load the class first, but delegate it to the parent class, which will be loaded by the parent class. If the parent class cannot be loaded at this time, feedback to the subclass, and the subclass will complete the loading of the class.
19. What are classloaders and what are classloaders?
20. Brief description of java memory allocation and recovery policy rate, Minor GC and Major GC
Objects are allocated first in the Eden area of the heap.
The big object went straight into the old age.
Long-term surviving objects will directly enter the old era when there is not enough space for allocation in the Eden area, a virtual machine execution of Minor GC.Minor Gc usually occurs in the Cenozoic Eden area, where the object survival time is short, the frequency of Gc is often high, and the recovery speed is relatively fast. Full Gc/Major GC occurs in the old age. In general, the Minor GC is not triggered when the old GC is triggered, but through configuration, a Minor GC can be performed before the Full GC, which can speed up the recycling speed of the old age.
This is the end of the content of "what are the test questions for the latest version of JVM virtual machine in 2021". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.