The JVM, short for Java Virtual Machine, is a specification for computing devices. The JVM is an imaginary computer that is implemented by emulating various computer functions on an actual computer.
This article according to their own personal understanding, to prepare, if there is a need to modify the message please below.
Before you write, you need to know two questions:
JVM is cross-platform, but are C and C++ cross-platform?
The answer, of course, is yes. Because programs written in C and C++ can run on Windows and Mac, they are cross-platform.
The JVM, then, is cross-platform and needs no explanation.
2, the difference between JVM, JDK, JRE?
The JVM is the Java VIRTUAL machine, the JDK is a compile-time environment, and the JRE is a runtime environment.
When the interviewer asks you this question, you can answer it in this way, and the following details are also provided on when the compile time and run time are.
Now for the main topic of the day:
A. Composition of JVM
B. Runtime data area: the compiled bytecode is loaded into memory (runtime data area). C. Execution engine: The execution engine is needed to run after loadingCopy the code
B. Class loading process:
B. Runtime data area
The JVM can recognize bytecode files (class files) and read bytecode files into memory. The runtime data area includes: thread shared area, thread exclusive area.Copy the code
As shown below, green represents thread-shared areas and yellow represents thread-exclusive areas (also known as private areas)
Run time data area: thread shared area, thread exclusive area
Thread shared area: heap, method area
Thread-exclusive area: virtual machine stack, local method stack, program counter
Program counter: Line number that points to the bytecode instruction executed by the current thread
The normal execution flow of a program is: Program > CPU > Thread > Run > JVM instructions (bytecode instructions)Copy the code
C, finally, Java magic number do not know you know?
Every compiled class file opens with the prefix “gargle”. Do you know why?
After converting the.class file to ASCII format, ca fe BA be is displayed
Cafe Babe is the Java LOGO, which is a coffee cup.
I am the advanced ball, let’s climb the pit in 2019. Feel to share very force words to praise, thank you!! If you have any questions, please leave a message below.