5 thoughts on “cheap wholesale biker jewelry What is a Java virtual machine?”
Cristina
best prices wholesale jewelry Virtual machine is an abstract computer that is achieved by simulation simulation on actual computers. java virtual machine has its own perfect hardware architecture, such as processors, stacks, registers, etc., and also has a corresponding instruction system. JVM blocks information related to the specific operating system platform, so that the Java program only needs to generate the target code (bytecode) running on the Java virtual machine, and it can run without modification on a variety of platforms. The explanation should be considered correct, but only describes the external behavior and functions of the virtual machine, and does not explain the internal principles. Under normal circumstances, we do not need to know the operating principle of the virtual machine, as long as you focus on writing the Java code, this is why the virtual machine exists-the difference between the underlying operating system platform and reduce the complexity based on the development of native language development Sex can enable the Java language to cross various platforms (as long as virtual machine manufacturers realize virtual machines on specific platforms), and it is easy to use. These are the external characteristics of the virtual machine, but explaining the virtual machine from this information is too general to let us know the internal principles.
The explanation JVM
. Let us try to understand the virtual machine from the level of the operating system. We know that the virtual machine is running in the operating system, so what can be run in the operating system? Of course, it is a process, because the process is the execution unit in the operating system. It can be understood like this that when it is running, it is a process instance in the operating system. When it is not running (stored in the file system as an executable file), it can be called the program. The students who are more familiar with the command line know that a command corresponds to a executable binary file. When this command is knocked down and returns to the car, it will create a process, load the corresponding executable file to the process of the process. In the address space, and execute the instructions. The following compares the problem of the C -Langu and Java language. Me a programs of the C language version first. The program for compiling the C language version:
gcc .c -o Running the C language version of the program: zhangjg@linux:/deve/workspace // src $. / hello world GCC compiler compile files are directly executable files that can be identified by the operating system. When we knock on the command line ./ This command is created directly, directly create a process, directly, directly create a process. And load the executable file to the address space of the process, and execute the instructions in the file.
The comparison, let's take a look at the compilation and execution form of the Java version of the HelloWord program. First write the source file helloword.java: The program to compile the Java version: run the Java version program:
From the above process, we can see that when we run the Java version of the program, the commands that are knocked into are not ./.class. Because the class file is not a binary executable file that can be directly recognized by the operating system. We knocked into the Java command. This command shows that the first thing we start is a program called Java. This Java program is a JVM process instance after running.
The command execution process above is: java command first starts the virtual machine process. After the virtual machine process is successfully started, read the parameter "", load him as the initial class to the memory, and it is loaded as the initial class to the memory. Initialize and dynamic links of this class (about the initialization and dynamic links of the class will be introduced in the later blogs), and then the main method of this class is executed. In other words, our .class file was not performed directly on the CPU after being loaded by the system, but was custody by a process called a virtual machine. First of all, the virtual machine process must be started, and then the necessary Class files are loaded by the class loader in the virtual machine, including the basic classes in JDK (such as String and Object, etc.), and then the virtual machine process explains the Class byte code instructions. These bytecode instruction translation cost machines CPU can recognize instructions to run on the CPU. In this perspective, when performing a so -called Java program, what is really executed is a process called Java virtual machine, not the class files we write. This process called the virtual machine processing some underlying operations, such as the distribution and release of memory, and so on. The class file we wrote is only the "raw material" required for the execution of the virtual machine process. These "raw materials" were loaded into the virtual machine during runtime, and were interpreted by the virtual machine to control some of the relative high -level operations defined in our Java code, such as creating a file. Information is regarded as a control information for virtual machines, which is a virtual instruction. The programming language also has its own principles. Learn a language, mainly to understand its principle. Seemingly a simple program, there are many in -depth content worthy of analysis. jvm architecture introduction In order to show the relationship between the virtual machine process and the Class file, the following picture is deliberately drawn: The content expressed according to the figure above, our compiled class file is used as Java as Java The raw materials of the virtual machine are entered inside the Java virtual machine, so who will do this part of work? In fact, inside the Java virtual machine, there is a subsystem called a class loader. This subsystem is used to load classes as needed at runtime. Note the four words "according to needs" in the above sentence. During the execution of the Java virtual machine, only when he needs one class, the class loader will be called to load this class, and all classes will not be loaded at the beginning of runtime. It's like a person who only goes to eat when he is hungry, instead of eating a year of meals in his stomach. Generally speaking, the timing of the virtual machine loading is used for the first time when using a new class. The articles behind this column will discuss the class loader in Java in detail. After being loaded by the virtual machine, after being loaded into the memory of the Java virtual machine, the virtual opportunity reads and executes the byte code instructions in it. The part of the byte code instruction in the virtual machine is called the execution engine. Just like a person, you do n’t have to eat the meal, and you have to digest it. The execution engine is equivalent to human gastrointestinal system. During the execution process, each class file will be connected dynamically. The content of the specific behavior and dynamic links of the execution engine will also be discussed in the subsequent articles of this column. Is we know that Java virtual opportunities are managed by automatic memory. Specifically, it is the useless object that automatically releases, and does not require programmers to write code to release the distributed memory. This part of the work is responsible for garbage collection subsystems. It's discussion can be known that a Java virtual machine instance has three subsystems during operation to ensure its normal operation, which are the type loader subsystem, performing engine subsystems and garbage collecting subsystems. As shown in the figure below: The operation of the virtual machine must load the Class file and execute the byte code instruction in the class file. It requires its own space to do so many things. Just like people eat things first in the stomach. The virtual machine also needs space to store the data. First of all, the loaded bytecode requires a separate memory space to store; the execution of a thread also requires the memory space to maintain the calling relationship, the data in the storage method and the intermediate calculation result; in the process of execution, it cannot be in the process of execution. To avoid creating objects, the objects created need a special memory space to store. The content of the data area of the virtual machine will also appear in the subsequent articles of this column. The memory area of the virtual machine can be divided into several parts shown in the figure below. (This is just about division, and it is not very detailed.) Summary The writing here, basically my understanding of the Java virtual machine is finished. Although the theme of this article is to deeply understand the Java virtual machine, you may feel that it is not "in -depth" at all, and it is just a general talk. I also feel like this. Limited to your own level, you can only do this. If you want to understand the Java virtual machine in depth, it is strongly recommended to read three books: "Deeper Java Virtual Machine" " " Java Virtual Machine Specifications " Actually I have read these books, but their interpretation of virtual machines is also based on an external model, but not in -depth analysis of the internal virtual machines in the virtual machine Implementation principle. The virtual machine is a large and complicated thing. People who realize the virtual machine are big cows. If they have not participated in the implementation of the virtual machine, few people should be able to penetrate it. Some of the articles behind this column also refer to these three books. Although there are countless books that explain the Java syntax, but I have seen these three books so far, and there are not many information on the Internet. The last summary: 1 The virtual machine is not mysterious. From the perspective of the operating system, it is just a normal process. 2 This process called virtual machine is special, and it can load the Class file we wrote. If JVM is compared to one person, then the class file is the food we eat. 3 loading the class file is a subsystem called a loader. It's like our mouth, eat food into the stomach. 4 The execution engine in the virtual machine is used to execute the byte code instruction in the class file. It's like our stomach, digesting the food we eat. 5 During the execution, the virtual machine must allocate the memory of the memory. When these objects are out of date, these useless objects must be cleaned up automatically. The task of cleaning up the memory of the memory is responsible for the garbage collector. It is like a food that people eat. After digestion, the waste must be excreted from the body. The space can be used to eat and digest the food when hungry next time. Extension information: A parameters of Java virtual machines are as follows: 1, run class file Class files that perform Main methods, java virtual machine [3] command parameter behavior: java u003Cclass file name> Note: Do not bring file suffix .class , for example: java test Use in the class file: package u003C; package name> then executed under the base road of the package, Java virtual machine command line parameters: java u003C; package name> .class file name name , for example: .java, the package is: com.ee2ee.test, the corresponding statement is: package com.ee2ee.test; .java and compiled after compilation The storage directory of class file .class file .class was as follows: Classes | __com | __ee2ee n | __test | __. java n | __. Class to run .class, and execute it in the CLASSES directory: java com.ee2ee2ee.test. 2, run the class principle of running in jar file, just add parameters to run the class file, just add the parameters -CP u003Cjar file name>; For example: execute the class com.ee2ee.test., command lines as follows: java -cp test.jar com.ee2ee.test. n3, display JDK version information r r r r r r r r When there are multiple JDK versions on a machine, you need to know that the current version of the JDK is used. Use the parameter -Version to know its version. The maximum memory that the virtual machine can use JAVA virtual machine is limited, and the default value is usually 64MB or 128MB. If an application occupies a large memory loading the memory in order to improve the performance, such as exceeding the default maximum value of 128MB, you need to increase the maximum memory that can be used in the Java virtual machine, otherwise Out of OUT of OUT OF Memory's abnormalities. When starting Java, you need to use the following two parameters: -xms java virtual machine initialization -xmx java virtual machine can use maximum memory above two command line parameters The SIZE set in the middle can bring a unit, for example: 256m indicates 256MB for example: java -xms128m -xmx256m ... means 128MB used when the java virtual machine initializes, which can be used to use The maximum memory is 256MB. For Tomcat, you can modify the script Catalina. SH (Unix platform) or Catalina.bat (Windows platform), set variable java_opts, for example: java_opts = -xms128m -xmx256m n reference materials : Baidu Encyclopedia-Java virtual machine
http http://www.jwholesale.com fashion-jewelry-wholesale s_idx 35537 1. Java virtual machine is an abstract computer that is achieved by simulation simulation on actual computers. The Java virtual machine has its own perfect hardware architecture, such as processors, stacks, registers, etc., and also has a corresponding instruction system. 2, Java virtual machine blocks information related to the specific operating system platform, so that the Java program only needs to generate the target code (byte code) running on the Java virtual machine, and you can modify it on multiple platforms without modification. Land. The expansion information:
JAVA virtual machine architecture JAVA virtual machine consists of five parts: a set of instruction sets, a set of registers, a stack, a useless unit collection (GARBAGE -ColleCted-Heap), a method area. These five parts are the logical ingredients of the Java virtual machine and do not rely on any implementation of technology or organization, but their functions must be implemented in a certain way in real machines. instruction sets java virtual machines support about 248 bytecies. Each byte code executes a basic CPU operation, for example, add an integer to the register, subroutine transfer, etc. The Java instruction set is equivalent to the assembly language of the Java program. java instruction concentration instructions contain a single byte operator, which is used to specify the operation to be executed, and there are 0 or more operations to provide the parameters or data required for the operation. Many instructions do not have the operation number, consisting of only a single byte operating symbol. The inner circulation of the virtual machine is as follows: DO { In a operating character byte; does a action according to the value of the operator; } While (The program is not over) Due to the simplicity of the instruction system, the process of execution of the virtual machine is very simple, which is conducive to improving the efficiency of execution. The number and size of the number of operations in the instruction are determined by the operating symbol. If the number of operations is larger than a byte, then the order of high -level bytes is preferred. For example, a 16 -bit parameter is stored in two bytes. The value is: The first byte*256 the second byte and byte code instruction flow is generally only byte alignment. The instruction Tabltch and Lookup are the exception, and the 4 -byte boundaries required for compulsory 4 bytes in the instructions are aligned. The registers java virtual machine register is used to save the operating state of the machine, similar to some special registers in the microprocessor. java virtual machine registers: pc: java program counter. ottop: Poin points to the top of the operating number stack. frame: Poin of the execution environment of the current execution method. vars: The pointer of the first variable area of the local variable area that is currently executed. The stack java virtual machines have three areas: local variable region, operating environment area, and operating number area. . Each Java method in the local variable area uses a fixed -size local variable set. They are designed according to the displacement of the VARS register. Local variables are all 32 -bit. This and dual -precision floating points occupy the space of two local variables, but the address is based on the index of the first local variable. (For example, a local variable with index N, if it is a dual -precision floating point number, then it actually occupies the storage space represented by index N and N 1.) Virtual machine specifications do not require 64 bits in local variables in local variables The value is 64 -bit. In the virtual machine provides instructions to load the values in the local variable to the operating number stack, and also provide instructions to write the value in the operation number stack into the local variable. : The information contained in the operating environment in the operating environment is used for dynamic links, and normal methods return and abnormal dissemination. · dynamic link The operating environment includes a pointer to the interpreter symbol table of the current class and the current method, which is used to support the dynamic link of the method code. The method code of the method uses the symbol when references the method to be called and the variables to be accessed. D dynamic link translating the method of symbolic form into a practical method call. The necessary classes are loaded to explain the symbols that have not been defined, and the variables can be translated into the offset address corresponding to the storage structure of these variables when runtime. dynamic link methods and variables make changes in other classes used in the method do not affect the code of this program. · Normal method Return If the current method is ended normally, when a return instruction with a correct type is performed, the call method will get a return value. Under normal return, the execution environment is used to restore the register of the caller, and add a proper value to the programmeter of the caller, call the execution instructions in the execution method, and then continue to execute in the execution environment of the caller's execution environment. Go down. · Abnormal and error spread The abnormal situation is called ERROR (error) or exception (abnormal) in Java. It is a subclass of the Throwable class. If you cannot find the required class file. ② Wrong when running, such as reference to an empty pointer · Program uses a Throw statement. When abnormalities occur, the Java virtual machine takes the following measures: · CATCH clause table linked to the current method. Each CATCH clause contains its effective instruction range, an exception type that can handle, and the code block address that processs abnormalities. · CATCH clauses that match abnormalities should meet the conditions below: the abnormal instructions that cause abnormal instructions, the abnormal type that occurs is a sub -type that can handle abnormal types. If found a matched CATCH clause, then the system is transferred to the specified abnormal processing block for execution; if no abnormal processing block is found, repeatedly find the process of matching the matching sentence, until all nested in the current method of the current method Catch sentences have been checked. · Since the virtual machine continues to execute from the first matching Catch clause, the order of the Catch clause table is very important. Because the Java code is structured, all the abnormal processors of a certain method can always be arranged into a table in order. Appropriate abnormal processing blocks to process abnormalities that occur under the value of the program counter. . If the matched Catch clause cannot be found, then the current method gets a result of a "unrecepted abnormality" and returns to the current method. It no corresponding abnormal processing blocks are still found in the caller, then this error communication will continue. If the error is spread to the top layer, the system will call a default abnormal processing block. Court of operating the stack area machine instructions only take the number of operations from the operating number stack, operate them, and return the results to the stack. The reason for selecting the stack structure is: on the machine (such as Intel486) with only a small number of registers or non -general registers, it can also efficiently simulate the behavior of the virtual machine. The operation number stack is 32 -bit. It is used to pass the parameters to the method, receive the result from the method, also use to support the operating parameters, and save the results of the operation. For example, IADD instructions add two integer. The two integer added should be two words on the top of the number of operations. This words are pressed into the stack by previous instructions. These two integers will pop up, add the stack, and press the results back to the operating number stack. Each original data type has special instructions to perform necessary operations for them. Each operation requires a storage position in the stack. Except for the Long and Double type, they need two positions. The number of operations can only be operated by its type of operation. For example, the number of two INT types is illegal if they are regarded as a number of Long type. In the implementation of the virtual machine of SUN, this limit is forced by bytecode authentication. However, there are a few operations (operating symbols PE and SWAP), which are used to operate the data area without considering the type. The unit collecting pile java pile is a runtime data area, and the instance (object) of the class allocates space from it. The Java language has the ability to collect useless units: it does not expand the ability to release the object. Java does not specify the useless units of collecting algorithms, which can use various algorithms according to the needs of the system. Method area The method area is similar to the post -compile code in traditional languages or the text segment in the UNIX process. It saves method code (compiled Java code) and symbol tables. In the current Java implementation, the method code is not included in the collection of useless units, but it is planned to be realized in the future version. Each file contains a Java class or a compiled code compiled by a Java interface. It can be said to be the execution code file of the Java language. In order to ensure that the platform of the class file is irrelevant, the format of class files in the Java virtual machine specification also explains in detail. For specific details, please refer to SUN's Java virtual machine specification. Reference materials: Baidu Encyclopedia-Java virtual machine
gold filled jewelry findings wholesale Java virtual machine is an abstract computer running all Java programs. JAVA virtual machine (JVM) a specification for computer equipment, which can be implemented in different ways (software or hardware). The instruction set of compiling virtual machines is very similar to the instruction set of compilation microcontroller. Java virtual machines include a set of bytecode instruction sets, a set of registers, a stack, a garbage recovery heap, and a storage method domain. java virtual machine (JVM) is an imaginary computer that can run Java code. As long as the JVM specification is described, the interpreter is transplanted to a specific computer, and any compiled Java code can be guaranteed to run on the system. java virtual machine is an imaginary machine that is implemented by software simulation on the actual computer. Java virtual machines have their own hardware, such as processors, stacks, registers, etc., and also have a corresponding instruction system. The expansion information:
java language is a very important feature is the irresponsibility of the platform. The use of Java virtual machines is the key to achieving this feature. If general high -level languages want to run on different platforms, at least need to be compiled into different target code. After introducing the Java language virtual machine, the Java language does not need to be re -compiled when running on different platforms. java language usage mode Java virtual machine blocks information related to specific platforms, so that the Java language compilation program only needs to generate the target code (byte code) running on the Java virtual machine, and you can not on a variety of platforms. Add to operate. When the Java virtual machine executes bytecode, the byte code is interpreted as a machine instruction on the specific platform. Reference materials: Baidu Encyclopedia-Java virtual machine
iron orchid studio jewelry wholesale Virtual machine is an abstract computer that is achieved by simulation simulation on actual computers. The Java virtual machine has its own perfect hardware architecture, such as processors, stacks, registers, etc., and also has a corresponding instruction system. JVM blocks information related to the specific operating system platform, so that the Java program only needs to generate the target code running on the Java virtual machine, and it can run without modification on a variety of platforms. java virtual machines: 1, Java virtual machines are not mysterious. From the perspective of the operating system, it is just a normal process. 2, this process called virtual machine is special, it can load the class file we wrote. If JVM is compared to one person, then the class file is the food we eat. 3, loading the class file is a subsystem called a class loader. It's like our mouth, eat food into the stomach. 4, the execution engine in the Java virtual machine is used to execute the byte code instruction in the Class file. It's like our stomach, digesting the food we eat. 5, Java virtual machines should allocate memory creation objects during the execution process. When these objects are out of date, these useless objects must be cleaned up automatically. The task of cleaning up the memory of the memory is responsible for the garbage collector. It is like a food that people eat. After digestion, the waste must be excreted from the body. The space can be used to eat and digest the food when hungry next time. The expansion information: java virtual machine is responsible for the security characteristics of the Java program design language and the irrelevant platform. The Java virtual machine blocks information related to the specific operating system platform, so that the Java language compiler only needs to generate the byte code running on the Java virtual machine, and it can run without modification on a variety of platforms. Java virtual machines make Java get rid of the restraint of specific machines, making it possible to cross different platform writing procedures. java virtual machine specifications define an abstract -instead of actual -machine or processor. This specification describes a instruction set, a set of registers, a stack, a "garbage dump", and a method area. Once a Java virtual machine is running on a given platform, any Java program (compiled program after compiled) can run on this platform. JAVA virtual machine (JVM) can explain the byte code by one instruction (map it to the actual processor instruction), or the byte code can also be called Just-in-in the actual processor Time's compiler is further compiled. Reference materials: Baidu Encyclopedia-Java virtual machine
wholesale jewelry in la Java virtual machine is an abstract computer running all Java programs. It is the operating environment of the Java language. It is one of the most attractive features of Java. java virtual machine has its own perfect hardware architecture, such as processors, stacks, registers, etc., and also has a corresponding instruction system. The Java virtual machine blocks information related to the specific operating system platform, so that the Java program only needs to generate the target code (bytecode) running on the Java virtual machine, and it can run without modification on a variety of platforms. java virtual machine is a specification for computer equipment, which can be implemented in different ways (software or hardware). Java virtual machine (JVM) is an imaginary computer that can run Java code. Java virtual machine specifications define an abstract -not actual -machine or processor. This specification describes a instruction set, a set of registers, a stack, and a method area. This information java virtual machine characteristics java language is very important to be irrelevant to the platform. The use of Java virtual machines is the key to achieving this feature. If general high -level languages want to run on different platforms, at least need to be compiled into different target code. After introducing the Java language virtual machine, the Java language does not need to be re -compiled when running on different platforms. java language usage mode Java virtual machine blocks information related to specific platforms, so that the Java language compilation program only needs to generate the target code (byte code) running on the Java virtual machine, and you can not on a variety of platforms. Add to operate. When the Java virtual machine executes bytecode, the byte code is interpreted as a machine instruction on the specific platform. Reference materials: Baidu Encyclopedia-Java virtual machine
best prices wholesale jewelry Virtual machine is an abstract computer that is achieved by simulation simulation on actual computers.
java virtual machine has its own perfect hardware architecture, such as processors, stacks, registers, etc., and also has a corresponding instruction system. JVM blocks information related to the specific operating system platform, so that the Java program only needs to generate the target code (bytecode) running on the Java virtual machine, and it can run without modification on a variety of platforms.
The explanation should be considered correct, but only describes the external behavior and functions of the virtual machine, and does not explain the internal principles. Under normal circumstances, we do not need to know the operating principle of the virtual machine, as long as you focus on writing the Java code, this is why the virtual machine exists-the difference between the underlying operating system platform and reduce the complexity based on the development of native language development Sex can enable the Java language to cross various platforms (as long as virtual machine manufacturers realize virtual machines on specific platforms), and it is easy to use. These are the external characteristics of the virtual machine, but explaining the virtual machine from this information is too general to let us know the internal principles.
The explanation JVM
. Let us try to understand the virtual machine from the level of the operating system. We know that the virtual machine is running in the operating system, so what can be run in the operating system? Of course, it is a process, because the process is the execution unit in the operating system. It can be understood like this that when it is running, it is a process instance in the operating system. When it is not running (stored in the file system as an executable file), it can be called the program.
The students who are more familiar with the command line know that a command corresponds to a executable binary file. When this command is knocked down and returns to the car, it will create a process, load the corresponding executable file to the process of the process. In the address space, and execute the instructions. The following compares the problem of the C -Langu and Java language.
Me a programs of the C language version first.
The program for compiling the C language version:
gcc .c -o
Running the C language version of the program:
zhangjg@linux:/deve/workspace // src $. /
hello world
GCC compiler compile files are directly executable files that can be identified by the operating system. When we knock on the command line ./ This command is created directly, directly create a process, directly, directly create a process. And load the executable file to the address space of the process, and execute the instructions in the file.
The comparison, let's take a look at the compilation and execution form of the Java version of the HelloWord program.
First write the source file helloword.java:
The program to compile the Java version:
run the Java version program:
zhangjg@linux:/deve/workspace/hellojava/ SRC $ java -classpath.
From the above process, we can see that when we run the Java version of the program, the commands that are knocked into are not ./.class. Because the class file is not a binary executable file that can be directly recognized by the operating system. We knocked into the Java command. This command shows that the first thing we start is a program called Java. This Java program is a JVM process instance after running.
The command execution process above is:
java command first starts the virtual machine process. After the virtual machine process is successfully started, read the parameter "", load him as the initial class to the memory, and it is loaded as the initial class to the memory. Initialize and dynamic links of this class (about the initialization and dynamic links of the class will be introduced in the later blogs), and then the main method of this class is executed. In other words, our .class file was not performed directly on the CPU after being loaded by the system, but was custody by a process called a virtual machine. First of all, the virtual machine process must be started, and then the necessary Class files are loaded by the class loader in the virtual machine, including the basic classes in JDK (such as String and Object, etc.), and then the virtual machine process explains the Class byte code instructions. These bytecode instruction translation cost machines CPU can recognize instructions to run on the CPU.
In this perspective, when performing a so -called Java program, what is really executed is a process called Java virtual machine, not the class files we write. This process called the virtual machine processing some underlying operations, such as the distribution and release of memory, and so on. The class file we wrote is only the "raw material" required for the execution of the virtual machine process. These "raw materials" were loaded into the virtual machine during runtime, and were interpreted by the virtual machine to control some of the relative high -level operations defined in our Java code, such as creating a file. Information is regarded as a control information for virtual machines, which is a virtual instruction.
The programming language also has its own principles. Learn a language, mainly to understand its principle. Seemingly a simple program, there are many in -depth content worthy of analysis.
jvm architecture introduction
In order to show the relationship between the virtual machine process and the Class file, the following picture is deliberately drawn:
The content expressed according to the figure above, our compiled class file is used as Java as Java The raw materials of the virtual machine are entered inside the Java virtual machine, so who will do this part of work? In fact, inside the Java virtual machine, there is a subsystem called a class loader. This subsystem is used to load classes as needed at runtime. Note the four words "according to needs" in the above sentence. During the execution of the Java virtual machine, only when he needs one class, the class loader will be called to load this class, and all classes will not be loaded at the beginning of runtime. It's like a person who only goes to eat when he is hungry, instead of eating a year of meals in his stomach. Generally speaking, the timing of the virtual machine loading is used for the first time when using a new class. The articles behind this column will discuss the class loader in Java in detail.
After being loaded by the virtual machine, after being loaded into the memory of the Java virtual machine, the virtual opportunity reads and executes the byte code instructions in it. The part of the byte code instruction in the virtual machine is called the execution engine. Just like a person, you do n’t have to eat the meal, and you have to digest it. The execution engine is equivalent to human gastrointestinal system. During the execution process, each class file will be connected dynamically. The content of the specific behavior and dynamic links of the execution engine will also be discussed in the subsequent articles of this column.
Is we know that Java virtual opportunities are managed by automatic memory. Specifically, it is the useless object that automatically releases, and does not require programmers to write code to release the distributed memory. This part of the work is responsible for garbage collection subsystems.
It's discussion can be known that a Java virtual machine instance has three subsystems during operation to ensure its normal operation, which are the type loader subsystem, performing engine subsystems and garbage collecting subsystems. As shown in the figure below:
The operation of the virtual machine must load the Class file and execute the byte code instruction in the class file. It requires its own space to do so many things. Just like people eat things first in the stomach. The virtual machine also needs space to store the data. First of all, the loaded bytecode requires a separate memory space to store; the execution of a thread also requires the memory space to maintain the calling relationship, the data in the storage method and the intermediate calculation result; in the process of execution, it cannot be in the process of execution. To avoid creating objects, the objects created need a special memory space to store. The content of the data area of the virtual machine will also appear in the subsequent articles of this column. The memory area of the virtual machine can be divided into several parts shown in the figure below. (This is just about division, and it is not very detailed.)
Summary
The writing here, basically my understanding of the Java virtual machine is finished. Although the theme of this article is to deeply understand the Java virtual machine, you may feel that it is not "in -depth" at all, and it is just a general talk. I also feel like this. Limited to your own level, you can only do this. If you want to understand the Java virtual machine in depth, it is strongly recommended to read three books:
"Deeper Java Virtual Machine"
"
" Java Virtual Machine Specifications "
Actually I have read these books, but their interpretation of virtual machines is also based on an external model, but not in -depth analysis of the internal virtual machines in the virtual machine Implementation principle. The virtual machine is a large and complicated thing. People who realize the virtual machine are big cows. If they have not participated in the implementation of the virtual machine, few people should be able to penetrate it. Some of the articles behind this column also refer to these three books. Although there are countless books that explain the Java syntax, but I have seen these three books so far, and there are not many information on the Internet.
The last summary:
1 The virtual machine is not mysterious. From the perspective of the operating system, it is just a normal process.
2 This process called virtual machine is special, and it can load the Class file we wrote. If JVM is compared to one person, then the class file is the food we eat.
3 loading the class file is a subsystem called a loader. It's like our mouth, eat food into the stomach.
4 The execution engine in the virtual machine is used to execute the byte code instruction in the class file. It's like our stomach, digesting the food we eat.
5 During the execution, the virtual machine must allocate the memory of the memory. When these objects are out of date, these useless objects must be cleaned up automatically. The task of cleaning up the memory of the memory is responsible for the garbage collector. It is like a food that people eat. After digestion, the waste must be excreted from the body. The space can be used to eat and digest the food when hungry next time.
Extension information:
A parameters of Java virtual machines are as follows:
1, run class file
Class files that perform Main methods, java virtual machine [3] command parameter behavior:
java u003Cclass file name>
Note: Do not bring file suffix .class
, for example:
java test
Use in the class file:
package u003C; package name>
then executed under the base road of the package, Java virtual machine command line parameters:
java u003C; package name> .class file name name
, for example:
.java, the package is: com.ee2ee.test, the corresponding statement is:
package com.ee2ee.test;
.java and compiled after compilation The storage directory of class file .class file .class was as follows:
Classes
| __com
| __ee2ee n | __test
| __. java n | __. Class
to run .class, and execute it in the CLASSES directory:
java com.ee2ee2ee.test.
2, run the class
principle of running in jar file, just add parameters to run the class file, just add the parameters -CP u003Cjar file name>;
For example: execute the class com.ee2ee.test., command lines as follows:
java -cp test.jar com.ee2ee.test. n3, display JDK version information r r r r r r r r
When there are multiple JDK versions on a machine, you need to know that the current version of the JDK is used. Use the parameter -Version to know its version. The maximum memory that the virtual machine can use
JAVA virtual machine is limited, and the default value is usually 64MB or 128MB.
If an application occupies a large memory loading the memory in order to improve the performance, such as exceeding the default maximum value of 128MB, you need to increase the maximum memory that can be used in the Java virtual machine, otherwise Out of OUT of OUT OF Memory's abnormalities. When starting Java, you need to use the following two parameters:
-xms java virtual machine initialization
-xmx java virtual machine can use maximum memory
above two command line parameters The SIZE set in the middle can bring a unit, for example: 256m indicates 256MB
for example:
java -xms128m -xmx256m ...
means 128MB used when the java virtual machine initializes, which can be used to use The maximum memory is 256MB.
For Tomcat, you can modify the script Catalina. SH (Unix platform) or Catalina.bat (Windows platform), set variable java_opts, for example:
java_opts = -xms128m -xmx256m n reference materials : Baidu Encyclopedia-Java virtual machine
http http://www.jwholesale.com fashion-jewelry-wholesale s_idx 35537 1. Java virtual machine is an abstract computer that is achieved by simulation simulation on actual computers. The Java virtual machine has its own perfect hardware architecture, such as processors, stacks, registers, etc., and also has a corresponding instruction system.
2, Java virtual machine blocks information related to the specific operating system platform, so that the Java program only needs to generate the target code (byte code) running on the Java virtual machine, and you can modify it on multiple platforms without modification. Land.
The expansion information:
JAVA virtual machine architecture
JAVA virtual machine consists of five parts: a set of instruction sets, a set of registers, a stack, a useless unit collection (GARBAGE -ColleCted-Heap), a method area. These five parts are the logical ingredients of the Java virtual machine and do not rely on any implementation of technology or organization, but their functions must be implemented in a certain way in real machines.
instruction sets
java virtual machines support about 248 bytecies. Each byte code executes a basic CPU operation, for example, add an integer to the register, subroutine transfer, etc. The Java instruction set is equivalent to the assembly language of the Java program.
java instruction concentration instructions contain a single byte operator, which is used to specify the operation to be executed, and there are 0 or more operations to provide the parameters or data required for the operation. Many instructions do not have the operation number, consisting of only a single byte operating symbol.
The inner circulation of the virtual machine is as follows:
DO {
In a operating character byte;
does a action according to the value of the operator;
} While (The program is not over)
Due to the simplicity of the instruction system, the process of execution of the virtual machine is very simple, which is conducive to improving the efficiency of execution. The number and size of the number of operations in the instruction are determined by the operating symbol. If the number of operations is larger than a byte, then the order of high -level bytes is preferred. For example, a 16 -bit parameter is stored in two bytes. The value is:
The first byte*256 the second byte and byte code instruction flow is generally only byte alignment. The instruction Tabltch and Lookup are the exception, and the 4 -byte boundaries required for compulsory 4 bytes in the instructions are aligned.
The registers
java virtual machine register is used to save the operating state of the machine, similar to some special registers in the microprocessor.
java virtual machine registers:
pc: java program counter.
ottop: Poin points to the top of the operating number stack.
frame: Poin of the execution environment of the current execution method.
vars: The pointer of the first variable area of the local variable area that is currently executed.
The stack
java virtual machines have three areas: local variable region, operating environment area, and operating number area.
. Each Java method in the local variable area uses a fixed -size local variable set. They are designed according to the displacement of the VARS register. Local variables are all 32 -bit.
This and dual -precision floating points occupy the space of two local variables, but the address is based on the index of the first local variable. (For example, a local variable with index N, if it is a dual -precision floating point number, then it actually occupies the storage space represented by index N and N 1.) Virtual machine specifications do not require 64 bits in local variables in local variables The value is 64 -bit.
In the virtual machine provides instructions to load the values in the local variable to the operating number stack, and also provide instructions to write the value in the operation number stack into the local variable.
: The information contained in the operating environment in the operating environment is used for dynamic links, and normal methods return and abnormal dissemination.
· dynamic link
The operating environment includes a pointer to the interpreter symbol table of the current class and the current method, which is used to support the dynamic link of the method code. The method code of the method uses the symbol when references the method to be called and the variables to be accessed.
D dynamic link translating the method of symbolic form into a practical method call. The necessary classes are loaded to explain the symbols that have not been defined, and the variables can be translated into the offset address corresponding to the storage structure of these variables when runtime.
dynamic link methods and variables make changes in other classes used in the method do not affect the code of this program.
· Normal method Return
If the current method is ended normally, when a return instruction with a correct type is performed, the call method will get a return value. Under normal return, the execution environment is used to restore the register of the caller, and add a proper value to the programmeter of the caller, call the execution instructions in the execution method, and then continue to execute in the execution environment of the caller's execution environment. Go down.
· Abnormal and error spread
The abnormal situation is called ERROR (error) or exception (abnormal) in Java. It is a subclass of the Throwable class. If you cannot find the required class file. ② Wrong when running, such as reference to an empty pointer
· Program uses a Throw statement.
When abnormalities occur, the Java virtual machine takes the following measures:
· CATCH clause table linked to the current method. Each CATCH clause contains its effective instruction range, an exception type that can handle, and the code block address that processs abnormalities.
· CATCH clauses that match abnormalities should meet the conditions below: the abnormal instructions that cause abnormal instructions, the abnormal type that occurs is a sub -type that can handle abnormal types.
If found a matched CATCH clause, then the system is transferred to the specified abnormal processing block for execution; if no abnormal processing block is found, repeatedly find the process of matching the matching sentence, until all nested in the current method of the current method Catch sentences have been checked.
· Since the virtual machine continues to execute from the first matching Catch clause, the order of the Catch clause table is very important.
Because the Java code is structured, all the abnormal processors of a certain method can always be arranged into a table in order. Appropriate abnormal processing blocks to process abnormalities that occur under the value of the program counter.
. If the matched Catch clause cannot be found, then the current method gets a result of a "unrecepted abnormality" and returns to the current method.
It no corresponding abnormal processing blocks are still found in the caller, then this error communication will continue. If the error is spread to the top layer, the system will call a default abnormal processing block.
Court of operating the stack area machine instructions only take the number of operations from the operating number stack, operate them, and return the results to the stack. The reason for selecting the stack structure is: on the machine (such as Intel486) with only a small number of registers or non -general registers, it can also efficiently simulate the behavior of the virtual machine. The operation number stack is 32 -bit.
It is used to pass the parameters to the method, receive the result from the method, also use to support the operating parameters, and save the results of the operation. For example, IADD instructions add two integer. The two integer added should be two words on the top of the number of operations.
This words are pressed into the stack by previous instructions. These two integers will pop up, add the stack, and press the results back to the operating number stack.
Each original data type has special instructions to perform necessary operations for them. Each operation requires a storage position in the stack. Except for the Long and Double type, they need two positions. The number of operations can only be operated by its type of operation. For example, the number of two INT types is illegal if they are regarded as a number of Long type.
In the implementation of the virtual machine of SUN, this limit is forced by bytecode authentication. However, there are a few operations (operating symbols PE and SWAP), which are used to operate the data area without considering the type.
The unit collecting pile
java pile is a runtime data area, and the instance (object) of the class allocates space from it. The Java language has the ability to collect useless units: it does not expand the ability to release the object. Java does not specify the useless units of collecting algorithms, which can use various algorithms according to the needs of the system.
Method area
The method area is similar to the post -compile code in traditional languages or the text segment in the UNIX process. It saves method code (compiled Java code) and symbol tables. In the current Java implementation, the method code is not included in the collection of useless units, but it is planned to be realized in the future version. Each file contains a Java class or a compiled code compiled by a Java interface.
It can be said to be the execution code file of the Java language. In order to ensure that the platform of the class file is irrelevant, the format of class files in the Java virtual machine specification also explains in detail. For specific details, please refer to SUN's Java virtual machine specification.
Reference materials: Baidu Encyclopedia-Java virtual machine
gold filled jewelry findings wholesale Java virtual machine is an abstract computer running all Java programs.
JAVA virtual machine (JVM) a specification for computer equipment, which can be implemented in different ways (software or hardware). The instruction set of compiling virtual machines is very similar to the instruction set of compilation microcontroller. Java virtual machines include a set of bytecode instruction sets, a set of registers, a stack, a garbage recovery heap, and a storage method domain.
java virtual machine (JVM) is an imaginary computer that can run Java code. As long as the JVM specification is described, the interpreter is transplanted to a specific computer, and any compiled Java code can be guaranteed to run on the system.
java virtual machine is an imaginary machine that is implemented by software simulation on the actual computer. Java virtual machines have their own hardware, such as processors, stacks, registers, etc., and also have a corresponding instruction system.
The expansion information:
java language is a very important feature is the irresponsibility of the platform. The use of Java virtual machines is the key to achieving this feature. If general high -level languages want to run on different platforms, at least need to be compiled into different target code. After introducing the Java language virtual machine, the Java language does not need to be re -compiled when running on different platforms.
java language usage mode Java virtual machine blocks information related to specific platforms, so that the Java language compilation program only needs to generate the target code (byte code) running on the Java virtual machine, and you can not on a variety of platforms. Add to operate. When the Java virtual machine executes bytecode, the byte code is interpreted as a machine instruction on the specific platform.
Reference materials: Baidu Encyclopedia-Java virtual machine
iron orchid studio jewelry wholesale Virtual machine is an abstract computer that is achieved by simulation simulation on actual computers. The Java virtual machine has its own perfect hardware architecture, such as processors, stacks, registers, etc., and also has a corresponding instruction system. JVM blocks information related to the specific operating system platform, so that the Java program only needs to generate the target code running on the Java virtual machine, and it can run without modification on a variety of platforms.
java virtual machines:
1, Java virtual machines are not mysterious. From the perspective of the operating system, it is just a normal process.
2, this process called virtual machine is special, it can load the class file we wrote. If JVM is compared to one person, then the class file is the food we eat.
3, loading the class file is a subsystem called a class loader. It's like our mouth, eat food into the stomach.
4, the execution engine in the Java virtual machine is used to execute the byte code instruction in the Class file. It's like our stomach, digesting the food we eat.
5, Java virtual machines should allocate memory creation objects during the execution process. When these objects are out of date, these useless objects must be cleaned up automatically. The task of cleaning up the memory of the memory is responsible for the garbage collector. It is like a food that people eat. After digestion, the waste must be excreted from the body. The space can be used to eat and digest the food when hungry next time.
The expansion information:
java virtual machine is responsible for the security characteristics of the Java program design language and the irrelevant platform. The Java virtual machine blocks information related to the specific operating system platform, so that the Java language compiler only needs to generate the byte code running on the Java virtual machine, and it can run without modification on a variety of platforms. Java virtual machines make Java get rid of the restraint of specific machines, making it possible to cross different platform writing procedures.
java virtual machine specifications define an abstract -instead of actual -machine or processor. This specification describes a instruction set, a set of registers, a stack, a "garbage dump", and a method area. Once a Java virtual machine is running on a given platform, any Java program (compiled program after compiled) can run on this platform.
JAVA virtual machine (JVM) can explain the byte code by one instruction (map it to the actual processor instruction), or the byte code can also be called Just-in-in the actual processor Time's compiler is further compiled.
Reference materials: Baidu Encyclopedia-Java virtual machine
wholesale jewelry in la Java virtual machine is an abstract computer running all Java programs. It is the operating environment of the Java language. It is one of the most attractive features of Java.
java virtual machine has its own perfect hardware architecture, such as processors, stacks, registers, etc., and also has a corresponding instruction system. The Java virtual machine blocks information related to the specific operating system platform, so that the Java program only needs to generate the target code (bytecode) running on the Java virtual machine, and it can run without modification on a variety of platforms.
java virtual machine is a specification for computer equipment, which can be implemented in different ways (software or hardware). Java virtual machine (JVM) is an imaginary computer that can run Java code. Java virtual machine specifications define an abstract -not actual -machine or processor. This specification describes a instruction set, a set of registers, a stack, and a method area.
This information
java virtual machine characteristics
java language is very important to be irrelevant to the platform. The use of Java virtual machines is the key to achieving this feature. If general high -level languages want to run on different platforms, at least need to be compiled into different target code. After introducing the Java language virtual machine, the Java language does not need to be re -compiled when running on different platforms.
java language usage mode Java virtual machine blocks information related to specific platforms, so that the Java language compilation program only needs to generate the target code (byte code) running on the Java virtual machine, and you can not on a variety of platforms. Add to operate. When the Java virtual machine executes bytecode, the byte code is interpreted as a machine instruction on the specific platform.
Reference materials: Baidu Encyclopedia-Java virtual machine