1 thought on “wholesale gold layered jewelry What are the essential differences between Dalvik virtual machine and Sun JVM in terms of architecture and execution”
Darrin
wholesale chunky jewelry usa (1) The first difference between DALVIK VM and JVM is that Dalvik VM is based on the register -based architecture, and JVM is a Stack Based. The advantage of the Reg Based VM is that AHEAD-OF-TIME can be better optimized. In addition, the VM of Reg Based is faster, but the price is a larger code length. (2) Another difference is that Dalvik can allow multiple Instance to run, which means that each Android app is running independently in a VM. , Will not affect others. Dalvik's design is a process below Linux every Dalvik. Then this requires efficient IPC. In addition, each VM is the advantage of running alone and can dynamically active Active/Deactive's own VM instead of affecting other VM (3) Next is argument about copyright. (See the following article) Since the reg base vm has so many benefits, why did the people who designed Java previously designed Java did not use REG Based but used Stack Based? It turns out that the VM of Stack Based also has its advantages, that is, it does not assume assumptions on the number of reG on the host platform, which is conducive to transplantation to different platforms. Dalvik does not care about this because it was originally designed for multi -REG platforms like ARM. In addition, DALVIK is transplanted to the X86, and even if it is a platform with few REGs such as X86, the VM of the Reg Based is no problem.
The advantage of DVM below: (I add black to highlight part of the text) 1. Optimize the code in advance during compilation instead of waiting at 2, the virtual machine is very small The space used is also small; it is designed to meet multiple virtual machine instances that can be able to run efficiently. 3, the constant pool has been modified to use only 32 -bit indexes, to simplify the interpreter
jvm bytecode is mainly in the form of zero address. In conceptual Essence The main development language of the application on the Google Android platform is Java, which runs the Java program through the Dalvik VM. In order to correctly achieve semantics, many designs of DALVIK VM take into account the compatibility with JVM; but it uses a register -based architecture, and its bytecode is mainly a mixed form of a two -address/third address.
This -based architecture -based architecture, who is faster? Now the actual processor is mostly based on the register -based architecture, which reflects from the side that the register is closer to the actual processor than the actual processor than the stack -based architecture. However, for VM, the value stack or register of the source architecture may be simulated with the memory of the actual machine, so the performance characteristics are different from the actual hardware. It is generally believed that the DALVIK VM based on the register -based architecture is more efficient than the execution of the stack architecture JVM. The reason is that although the zero address instruction is more compact, it requires more Load/Store instructions to complete the operation, which also means that more instructions are distributed (Dispatch ) Number of times and memory access; access memory is an important bottleneck for execution speed. Although the second or third address instructions have more space for each instruction, in general There are fewer access.
. From the screenshots below, we can clearly see the comparison of Java Bytecode and Dalvid Bytecode corresponding to the same Java code: u003Cimg src = "pic4.mg/_b.jpg" class = "content_image "> u003Cimg src =" pic2.mg/_b.jpg "class =" content_image "> Some articles on the Internet mostly mention that Dalvik's execution speed is faster than JVM, but the transplantability is slightly worse. Let's extend here. Perform VM instructions on one interpreter, including three steps, instructions assigned, access operations, and execution calculations. Dispatch is responsible for reading VM instructions from memory, and then jump to the corresponding interpreter code instruction distribution. As mentioned above, completing the same thing, the stack -based virtual machine requires more instructions, which means that more instructions distribute and memory access. This is one of the reasons why the execution performance of JVM is not as good as that of Dalvik VM. When some articles on the Internet discuss Dalvik, most of them simply mention that Dalvik's execution speed is faster than JVM, but the transplantability is slightly worse. Let's extend here. Perform VM instructions on one interpreter, including three steps, instructions assigned, access operations, and execution calculations. Dispatch is responsible for reading VM instructions from memory, and then jump to the corresponding interpreter code instruction distribution. As mentioned above, completing the same thing, the stack -based virtual machine requires more instructions, which means that more instructions distribute and memory access. This is one of the reasons why the execution performance of JVM is not as good as that of Dalvik VM. The access to the number of access operations (Operands Access) refers to the number of operations and the number of operators read and write back source operations. Dalvik VM accesses the number of operations through the virtual operating number register. Due to the similar blood, Dalvik's virtual register has more advantages in mapping to physical registers, which is also a reason for the better performance of Dalvik VM. The number of operations of the JVM is accessed by the operating number stack, and because the instruction does not use any general registers, it can be freely allocated to allocate the actual machine register in the implementation of the virtual machine, so the transplantability can be high. As an optimization, the operating number stack can also be mapped to the physical register by the compiler to reduce the data movement overhead. This seems to have nothing to explain, just execute it honestly. The instruction execution
This will define many categories in an application. After the compilation is completed, there will be a lot of corresponding class files, and there will be a lot of redundant information between the class files. DEX bytecode and standard Java bytecode (Class) The difference between the structure is that DEX bytecode integrates multiple files into one. In this way, in addition to reducing the overall file size, I/O operation, It also improves the search speed of the class. The constant pool in each class file is now managed by a constant pool in the Dex file. DEX files can be further optimized. The optimization is mainly for the following aspects:
1, adjusting the byte order of all fields (Little_Endian) and the alignment structure in the alignment structure n3. Optimize some specific classes, optimize the operating code in the method
The optimized and optimized file size will increase, which should be 1-4 times the original DEX file. ODEX is to further improve performance during operation, further optimization of the dex file u003Cimg src = "pic3.mg/_b.jpg" class = "content_image"> Each Android application runs in a Dalvik virtual In the machine instance, each virtual machine instance is an independent process space. Each process can be communicated (IPC, Binder mechanism). The thread mechanism, memory allocation and management of virtual machines, Mutex, etc. are achieved by relying on the underlying operating system. Each Android application runs in a Dalvik virtual machine instance, and each virtual machine instance is an independent process space. Each process can be communicated (IPC, Binder mechanism). The thread mechanism, memory allocation and management of virtual machines, Mutex, etc. are achieved by relying on the underlying operating system. Different applications run in different process spaces. When a virtual mechanism is closed or accidentally suspends, it will not affect other virtual machines. It can protect the safety and independent operation of the application to the greatest extent. zygote is an incubator for virtual machine instances. The execution of .main () in .cpp will complete a split, and the split sub -process continues to initialize the architecture of the Java layer. This split process is System_Server. Whenever the system requires a Android application, Zygote will fork a sub -process to execute the application. The benefits of doing so are obvious: the Zygote process is generated during the system start. It will complete the operation of the virtual machine, the loading of the library, the loading and initialization of the preset library. At that time, Zygote provides a system at the fastest to replicate itself. In addition, for some read -only system libraries, all virtual machine instances share a memory area with Zygote, which greatly saves memory overhead. u003Cimg src = "pic2.mg/_b.jpg" data-rawwidth = "382" data-rawheight = "315" class = "content_image" width = "382"> =================== ============================================ It, I briefly summarize the effects of the differences in the architecture of DVM and JVM with my cognition. , Cross -order program operating environment (VM). The purpose of DVM is to provide the local resources and environment of Android OS with a unified interface to the application to develop. Strictly speaking, DVM is not a real VM. It just provides a VM environment during development, and does not provide real VM containers when running. This is why JVM must be designed as Stack-Based.
jvm: All JAR programs are provided by JVM, including the scheduling of various resources during operation, and the architecture of JVM, which can be designed in a JVM Program, JVM is like a real "machine" that can run multiple programs. If you go to see some enterprise-level JVM (such as Tom Cat, WAS), from the process management of OS, you can only see a process of JVM (of course, you can also start multiple JVM, but the JVM architecture is OS- JVM-APP's 3-layer runtime mode), and no program running in JVM, and a JVM, you can run multiple Java App. To put it simply, JVM completely blocks the connection between the application and OS, and switched to JVM as the middle layer. This is also a real cross -platform operation that VM must be done. As long as it is the same JDK, JVM provides a completely consistent operating environment for all procedures running in it, no matter what kind of underlying OS and hardware conditions you are. Therefore, this is also in other answers that JVM is characterized by the intersection of the underlying OS and the hardware environment to ensure this consistency. The interaction between all applications and underlying resources must be realized by the transfer and conversion of JVM. JVM truly realizes all the functions of OS for management of applications. From the perspective and operation of the development environment, they are completely consistent true VM
DVM: and DVM is characterized by using Zygote. Zygote has several very interesting characteristics. 1 is the pre -load of Zygote, which first determines the needs of the installed APK and the characteristics of interdependence trees, as well as the characteristics of the OS and hardware environment. Can you easily find out the reasons why it can easily find out those key local resources?), This means that the more applications you have installed, the slower the loading of zygote. Generally speaking The slower the mobile phone will start. In addition, in different hardware environments (eg, there are GPS chips) Zygote initialized examples are different. In other words, Zygote does not provide a unified operating environment and has better flexibility. This mechanism means that DVM can take the underlying resources to provide upper -level applications. The difference is only in the process of program installation or startup. DVM It can be prompted that the program needs resources, and the local environment may fail to meet and cause it to run. DVM's zygote does not provide a runner -up container. It only provides a process for sharing. All applications run, independent, OS -level processes, directly affected by the resource control and scheduling at the OS level. It's just that they share Zygote and say the pre -loading class. That's why I say, DVM is like adding a set to each application at the bottom, not a real VM at the time of runtime. In other words, the VM platform provided in the development environment is likely to be inconsistent with the runtime environment. The VM platform provided in the development environment is a collection of possible environment during various runtime. In this point of view, generally we believe that the collapse of the Java program in JVM will cause the collapse of JVM and not cause OS collapse. Everyone should be very common. But do you generally do not see the Java program leading to crash, right? Because a JVM is separated from the middle of the run. (Of course, there are actually some small doors that can use Java programs to collapse OS, because this, I have gambled with some Java Da Na, who has won the meal, huh, but this is other topics, it is not expanded here)
In addition, in the JVM mechanism, different programs, after packaging, they are running a truly independent program (referring to the relationship between the program to apply them, not the relationship with JVM), even if the relationship with JVM), even if the relationship with JVM), even if the relationship with JVM) is They used the same class in the bag, and they were loaded separately when runtime (and loaded multiple times). DVM, a pre-load-sharing mechanism, allows different applications to share the same classes when running. Generally speaking, in terms of system resource consumption, it has higher efficiency.
. Finally, add it. Byte Code does not mean that it is an interpretation execution. In fact, the programs of different Byte Code, different technologies, and different specific languages, the real implementation situation is very complicated and difficult to generalize. Many cases of hybrid technology. From my technology for ODEX, it is that it is, that is, that is, it is, that is, that is, it is, that is, that is, it is, that is, that is, it is, that is, that is, it is, that is, that is, it is, that is, that is, that is, it is, that is, that is, that is, it is, that is, that is, that is, it is, that is, that is, it is, that is, that is, that is, it is. A typical case. Of course, this is an out -of -the -ware story, no more unfolding
wholesale chunky jewelry usa (1) The first difference between DALVIK VM and JVM is that Dalvik VM is based on the register -based architecture, and JVM is a Stack Based. The advantage of the Reg Based VM is that AHEAD-OF-TIME can be better optimized. In addition, the VM of Reg Based is faster, but the price is a larger code length.
(2) Another difference is that Dalvik can allow multiple Instance to run, which means that each Android app is running independently in a VM. , Will not affect others. Dalvik's design is a process below Linux every Dalvik. Then this requires efficient IPC. In addition, each VM is the advantage of running alone and can dynamically active Active/Deactive's own VM instead of affecting other VM
(3) Next is argument about copyright. (See the following article)
Since the reg base vm has so many benefits, why did the people who designed Java previously designed Java did not use REG Based but used Stack Based? It turns out that the VM of Stack Based also has its advantages, that is, it does not assume assumptions on the number of reG on the host platform, which is conducive to transplantation to different platforms. Dalvik does not care about this because it was originally designed for multi -REG platforms like ARM. In addition, DALVIK is transplanted to the X86, and even if it is a platform with few REGs such as X86, the VM of the Reg Based is no problem.
The advantage of DVM below: (I add black to highlight part of the text)
1. Optimize the code in advance during compilation instead of waiting at
2, the virtual machine is very small The space used is also small; it is designed to meet multiple virtual machine instances that can be able to run efficiently.
3, the constant pool has been modified to use only 32 -bit indexes, to simplify the interpreter
jvm bytecode is mainly in the form of zero address. In conceptual Essence The main development language of the application on the Google Android platform is Java, which runs the Java program through the Dalvik VM. In order to correctly achieve semantics, many designs of DALVIK VM take into account the compatibility with JVM; but it uses a register -based architecture, and its bytecode is mainly a mixed form of a two -address/third address.
This -based architecture -based architecture, who is faster? Now the actual processor is mostly based on the register -based architecture, which reflects from the side that the register is closer to the actual processor than the actual processor than the stack -based architecture. However, for VM, the value stack or register of the source architecture may be simulated with the memory of the actual machine, so the performance characteristics are different from the actual hardware. It is generally believed that the DALVIK VM based on the register -based architecture is more efficient than the execution of the stack architecture JVM. The reason is that although the zero address instruction is more compact, it requires more Load/Store instructions to complete the operation, which also means that more instructions are distributed (Dispatch ) Number of times and memory access; access memory is an important bottleneck for execution speed. Although the second or third address instructions have more space for each instruction, in general There are fewer access.
. From the screenshots below, we can clearly see the comparison of Java Bytecode and Dalvid Bytecode corresponding to the same Java code: u003Cimg src = "pic4.mg/_b.jpg" class = "content_image "> u003Cimg src =" pic2.mg/_b.jpg "class =" content_image "> Some articles on the Internet mostly mention that Dalvik's execution speed is faster than JVM, but the transplantability is slightly worse. Let's extend here. Perform VM instructions on one interpreter, including three steps, instructions assigned, access operations, and execution calculations. Dispatch is responsible for reading VM instructions from memory, and then jump to the corresponding interpreter code instruction distribution. As mentioned above, completing the same thing, the stack -based virtual machine requires more instructions, which means that more instructions distribute and memory access. This is one of the reasons why the execution performance of JVM is not as good as that of Dalvik VM. When some articles on the Internet discuss Dalvik, most of them simply mention that Dalvik's execution speed is faster than JVM, but the transplantability is slightly worse. Let's extend here. Perform VM instructions on one interpreter, including three steps, instructions assigned, access operations, and execution calculations. Dispatch is responsible for reading VM instructions from memory, and then jump to the corresponding interpreter code instruction distribution. As mentioned above, completing the same thing, the stack -based virtual machine requires more instructions, which means that more instructions distribute and memory access. This is one of the reasons why the execution performance of JVM is not as good as that of Dalvik VM.
The access to the number of access operations (Operands Access) refers to the number of operations and the number of operators read and write back source operations. Dalvik VM accesses the number of operations through the virtual operating number register. Due to the similar blood, Dalvik's virtual register has more advantages in mapping to physical registers, which is also a reason for the better performance of Dalvik VM. The number of operations of the JVM is accessed by the operating number stack, and because the instruction does not use any general registers, it can be freely allocated to allocate the actual machine register in the implementation of the virtual machine, so the transplantability can be high. As an optimization, the operating number stack can also be mapped to the physical register by the compiler to reduce the data movement overhead. This seems to have nothing to explain, just execute it honestly. The instruction execution
This will define many categories in an application. After the compilation is completed, there will be a lot of corresponding class files, and there will be a lot of redundant information between the class files.
DEX bytecode and standard Java bytecode (Class) The difference between the structure is that DEX bytecode integrates multiple files into one. In this way, in addition to reducing the overall file size, I/O operation, It also improves the search speed of the class.
The constant pool in each class file is now managed by a constant pool in the Dex file.
DEX files can be further optimized. The optimization is mainly for the following aspects:
1, adjusting the byte order of all fields (Little_Endian) and the alignment structure in the alignment structure n3. Optimize some specific classes, optimize the operating code in the method
The optimized and optimized file size will increase, which should be 1-4 times the original DEX file. ODEX is to further improve performance during operation, further optimization of the dex file
u003Cimg src = "pic3.mg/_b.jpg" class = "content_image"> Each Android application runs in a Dalvik virtual In the machine instance, each virtual machine instance is an independent process space. Each process can be communicated (IPC, Binder mechanism). The thread mechanism, memory allocation and management of virtual machines, Mutex, etc. are achieved by relying on the underlying operating system. Each Android application runs in a Dalvik virtual machine instance, and each virtual machine instance is an independent process space. Each process can be communicated (IPC, Binder mechanism). The thread mechanism, memory allocation and management of virtual machines, Mutex, etc. are achieved by relying on the underlying operating system.
Different applications run in different process spaces. When a virtual mechanism is closed or accidentally suspends, it will not affect other virtual machines. It can protect the safety and independent operation of the application to the greatest extent.
zygote is an incubator for virtual machine instances. The execution of .main () in .cpp will complete a split, and the split sub -process continues to initialize the architecture of the Java layer. This split process is System_Server. Whenever the system requires a Android application, Zygote will fork a sub -process to execute the application. The benefits of doing so are obvious: the Zygote process is generated during the system start. It will complete the operation of the virtual machine, the loading of the library, the loading and initialization of the preset library. At that time, Zygote provides a system at the fastest to replicate itself. In addition, for some read -only system libraries, all virtual machine instances share a memory area with Zygote, which greatly saves memory overhead. u003Cimg src = "pic2.mg/_b.jpg" data-rawwidth = "382" data-rawheight = "315" class = "content_image" width = "382">
=================== ============================================
It, I briefly summarize the effects of the differences in the architecture of DVM and JVM with my cognition. , Cross -order program operating environment (VM). The purpose of DVM is to provide the local resources and environment of Android OS with a unified interface to the application to develop. Strictly speaking, DVM is not a real VM. It just provides a VM environment during development, and does not provide real VM containers when running. This is why JVM must be designed as Stack-Based.
jvm: All JAR programs are provided by JVM, including the scheduling of various resources during operation, and the architecture of JVM, which can be designed in a JVM Program, JVM is like a real "machine" that can run multiple programs. If you go to see some enterprise-level JVM (such as Tom Cat, WAS), from the process management of OS, you can only see a process of JVM (of course, you can also start multiple JVM, but the JVM architecture is OS- JVM-APP's 3-layer runtime mode), and no program running in JVM, and a JVM, you can run multiple Java App. To put it simply, JVM completely blocks the connection between the application and OS, and switched to JVM as the middle layer. This is also a real cross -platform operation that VM must be done. As long as it is the same JDK, JVM provides a completely consistent operating environment for all procedures running in it, no matter what kind of underlying OS and hardware conditions you are. Therefore, this is also in other answers that JVM is characterized by the intersection of the underlying OS and the hardware environment to ensure this consistency. The interaction between all applications and underlying resources must be realized by the transfer and conversion of JVM. JVM truly realizes all the functions of OS for management of applications. From the perspective and operation of the development environment, they are completely consistent true VM
DVM: and DVM is characterized by using Zygote. Zygote has several very interesting characteristics.
1 is the pre -load of Zygote, which first determines the needs of the installed APK and the characteristics of interdependence trees, as well as the characteristics of the OS and hardware environment. Can you easily find out the reasons why it can easily find out those key local resources?), This means that the more applications you have installed, the slower the loading of zygote. Generally speaking The slower the mobile phone will start. In addition, in different hardware environments (eg, there are GPS chips) Zygote initialized examples are different. In other words, Zygote does not provide a unified operating environment and has better flexibility. This mechanism means that DVM can take the underlying resources to provide upper -level applications. The difference is only in the process of program installation or startup. DVM It can be prompted that the program needs resources, and the local environment may fail to meet and cause it to run. DVM's zygote does not provide a runner -up container. It only provides a process for sharing. All applications run, independent, OS -level processes, directly affected by the resource control and scheduling at the OS level. It's just that they share Zygote and say the pre -loading class. That's why I say, DVM is like adding a set to each application at the bottom, not a real VM at the time of runtime. In other words, the VM platform provided in the development environment is likely to be inconsistent with the runtime environment. The VM platform provided in the development environment is a collection of possible environment during various runtime.
In this point of view, generally we believe that the collapse of the Java program in JVM will cause the collapse of JVM and not cause OS collapse. Everyone should be very common. But do you generally do not see the Java program leading to crash, right? Because a JVM is separated from the middle of the run. (Of course, there are actually some small doors that can use Java programs to collapse OS, because this, I have gambled with some Java Da Na, who has won the meal, huh, but this is other topics, it is not expanded here)
In addition, in the JVM mechanism, different programs, after packaging, they are running a truly independent program (referring to the relationship between the program to apply them, not the relationship with JVM), even if the relationship with JVM), even if the relationship with JVM), even if the relationship with JVM) is They used the same class in the bag, and they were loaded separately when runtime (and loaded multiple times).
DVM, a pre-load-sharing mechanism, allows different applications to share the same classes when running. Generally speaking, in terms of system resource consumption, it has higher efficiency.
. Finally, add it. Byte Code does not mean that it is an interpretation execution. In fact, the programs of different Byte Code, different technologies, and different specific languages, the real implementation situation is very complicated and difficult to generalize. Many cases of hybrid technology. From my technology for ODEX, it is that it is, that is, that is, it is, that is, that is, it is, that is, that is, it is, that is, that is, it is, that is, that is, it is, that is, that is, it is, that is, that is, that is, it is, that is, that is, that is, it is, that is, that is, that is, it is, that is, that is, it is, that is, that is, that is, it is. A typical case. Of course, this is an out -of -the -ware story, no more unfolding