JVM Introduction

JVM description:

JVM is a Java Virtual Machine (Java Virtual Machine abbreviation), JVM is a code of a computing device, which is a fictional computer, is passed over the actual computer simulation of various computer-implemented functions.

Java language is a very important characteristic is the platform independence. The use of Java Virtual Machine is the key to achieving this characteristic. General high-level language if you want to run on different platforms, at least needs to be compiled into a differentobject code. And after the introduction of Java virtual machine language, Java language does not need to be recompiled to run on different platforms when. Java Virtual Machine using Java language information associated with a particular shielding platform, so that the Java languagecompilersimply generate object code (running on a Java Virtual Machinebyte code), can be run without modification on multiple platforms . Java Virtual Machine byte code, when executed, the bytecode interpreter as the platform-specificmachine instructionsexecuted. This is Java's ability to "compile once, run anywhere" reasons.

java source code compilation

java basic data types

byte: // 1 -byte signed integer complement
short: // 2-byte signed integer complement
int: // 4-byte signed integer complement
long: // 8-byte signed integer complement
float: // 4 bytes IEEE754 single precision floating point
double: // 8-byte IEEE754 double precision floating point
char: // 2 -byte unsigned Unicode character
boolean: boolean data type represents one bit of information

Other types of data

javaObject one object // (object) of 4-byte reference
returnAddress // 4 bytes, used jsr / ret / jsr-w / ret-w command

JVM virtual machine memory structure

JVM virtual machine memory into its program counter, the virtual machine stack, native method stacks, java heap, the method area.

Program Counter: is a private memory space, is relatively small. The main record a command to be run.

VM stack: is thread-private memory space, and at the same time create a java thread, mainly used to save local variables, partial results, and participatory methods of call and return. (Using something called "stack frame" of the data structure of the virtual machine runtime stack to save context data.)

Native method stacks: VM stack for call management functions java, native method stacks used to call local management method (method implemented in C)

java heap: all objects, arrays are allocated on the heap space.

Heap is divided into: the new generation, the old era.

New Generation: Young stored objects and objects just generated. Cenozoic is divided into: e'den (when the object just created), survivor space (), 1 (GC at least once).

The method area (permanent area): is shared by all threads in the JVM (java independent of the memory heap). The main metadata stored in the class (the class type information, constant pool, field information, the method Information: definition information storing constants and the like). When GC recovery, recovering only recovering persistent constant pool area (unreferenced constant), and later recovering the class metadata.

 

 

JVM Baidu Encyclopedia Address: https://baike.baidu.com/item/JVM/2902369?fr=aladdin

 

Guess you like

Origin www.cnblogs.com/ming-blogs/p/10958621.html