JVM internal implementation mechanism and the basic concepts

2010-12-09  来源:本站原创  分类:Java  人气:80 

Interest due, find some simple introduction about the JVM, be it literacy.

1. JVM implementation mechanism

Java Virtual Machine is a small computer, has its own instruction set, with its own file system, management, and data within the table is responsible for reading the byte code class file inside, and then converted into different operating system, CPU instructions, making Java programs on different operating systems up and running smoothly. Therefore, the JVM can Window into bytecode instruction set Window system, Linux's JVM byte code can convert the bytes into Linux systems, the same token there is Solaris, which is not common among.

Although a prototype first developed by Sun, but in fact, developed to any vendor can implement themselves to a virtual machine, used to read the byte code into the OS command. We can think even with the Java programming language, JVM does not matter, because even if you use Notepad to write a string of byte code, but also allows to parse the JVM to run, as long as you pass the JVM byte code verification.

JVM verification is very strict, they talk about some interesting places here. Members will recall that the icon is a cup of Java coffee? Study its history we might find out why, but there are even more obvious way is how to determine whether a file JVM is the class file? JVM approach is to read the first 4 bytes into a hexadecimal number 16, to determine whether this number is equal to 0xCAFEBABE. Noticed the word begin?

"Cafebabe", represents a foreign coffee brand, called Peet'scoffee-baristas seem to like. In order to facilitate creation of Java memory of those who choose such a class of 16 hexadecimal numbers as a standard file header, so any class file must have the 4 bytes in the head. We can implement this interface DataInput class to test, read any one of the first class file int, int in Java which is four bytes. 16 hex will be converted into a 0xcafebabe's. So here to tell you is, JVM is actually not so mysterious, we can fully understand its structure. Introductions over and then look at the JVM JVM implementation mechanism within the basic concept.

2.JVM the basic concept of the internal

Java virtual machine inside an idea, all the enumeration is unrealistic, too complicated and no meaning. Unless you really want to do yourself a JVM. I only listed some concepts:
First we look at a variable called ReturnAddress, which is used to store method JVM or to jump the export basis, to any address stored in the variable will be in accordance with the address to jump. We need to note that finally there is a higher return than the method of the priority assigned to ReturnAddress. Method of return and finallyreturn exist, it must be inside by finally return prevail.

Have their own JVM Heap, can be shared for all threads, all objects are stored, the memory is allocated dynamically. For each thread has its own Stack, stack inside the storage unit called Frame (frame). Frame inside to record the zero variable, object reference address, method return values and other data. JVM There is also a place called MethodArea, store the executable code section by section, each section is a method body, can also be shared for all threads. In fact, we say that a thread running from the run way up, it is saying the class is declared in the other two concepts. Because all other methods, including the object, this time as a resource to be threads.

JVM has its own memory management program, because it has the function of the file system, we can as a small database, the inside has lots of different tables. The field may be another table a table of address can also store the data value is the address of a value. JVM when the class of all running calculation of the analytical verification management, are actually changes in the management of these tables, if the point of view from the database, JVM does is based on your code to handle multiple tables then the final the results of the process is returned to you. Inside the table structure including the class of the table, field table, method table, attribute table and so on.

相关文章
  • JVM internal implementation mechanism and the basic concepts 2010-12-09

    Interest due, find some simple introduction about the JVM, be it literacy. 1. JVM implementation mechanism Java Virtual Machine is a small computer, has its own instruction set, with its own file system, management, and data within the table is respo

  • ORACLE implementation plan of some basic concepts 2011-03-22

    ORACLE implementation plan of some basic concepts (1) One. Related Concepts Rowid concept: rowid is a pseudo-column, since it is pseudo column, this column is not user-defined, but the system itself to add the. For each table has a rowid pseudo-colum

  • ORACLE implementation plan of some basic concepts 2 2011-03-22

    ORACLE implementation plan of some basic concepts (2) III. The connection between the table Join an attempt to combine the two predicate table, one can only connect two tables, table join is also called table association. In the following description

  • Oracle database implementation plan some basic concepts 2011-08-28

    Oracle database implementation plan some basic concepts One. Related Concepts Rowid concept: rowid is a pseudo-column, since it is pseudo-column, then this column is not user-defined, but the system of their own to add. For each table has a rowid pse

  • Beginners Introduction to the 30 needed to master the basic concepts of 2010-07-30

    Java Basics: Introduction to beginners need to master the basic concepts of the 30 basic concepts 1.OOP the only relationship is what the interface object, like a computer power supply vendors within the structure of her no matter what, he can only g

  • Netfilter implementation mechanism 2010-08-06

    1. Foreword Netfilter as the current packet filtering, connection tracking, address translation, etc. The main implementation framework, to understand its internal mechanisms for better use of Netfilter our design is critical, so this by reading the

  • [JVM] JVM internal principle 2010-09-05

    JVM internal principle ======== JVM virtual machine to load the main class file and executes the byte code. It includes the ClassLoader class loader and Enginee execution engine. Engines, including one-time general interpretation engine (byte code di

  • Linux thread implementation mechanism (transfer) 2011-01-04

    Original Address: http://www.ibm.com/developerworks/cn/linux/kernel/l-thread/ One. Basic knowledge: the thread and process in accordance with the textbook definition of resource management process is the smallest unit, the thread is the smallest unit

  • Basic concepts of AOP 2010-03-31

    First, we come to understand some basic concepts in AOP. These concepts are common AOP terminology is not unique to Spring.NET. Unfortunately, AOP terminology is not particularly intuitive. But if Spring.NET to define their own special term, may be m

  • Project management using Maven 1 - Basic Concepts 2010-02-20

    This article describes the basic concepts of Maven, the next blog post for project management using Maven 2 - Management with Maven simple Java project, we will apply the tools and Maven Maven ideological construction of a simple Java management proj

  • Introduction to WAP development and improvement of the basic concepts WML - WML simple example and editing. Test methods 2010-07-30

    Part II: WML basic concepts - WML simple examples and editing, test methods Complete the WAP server and WAP browser, the establishment of the installation, we then can use WAP WML language to write Web pages or applications, and through WAP server an

  • Android UI overview of the basic concepts of user interface development 2010-08-28

    Android UI Programming Interface Overview In this paper, the user interface of the Android UI open some of the basic concepts, not to do in-depth explanations, but you can quickly browse Android open often involves some basic concepts and elements. 1

  • Chen's Android Notes (1) - Basic concepts 2010-09-05

    Reproduced, indicate the source, the paper quotes the book as a reference part of the original. As a beginner, buy the Hello Android-Android Essentials (English translation). Then there came the Internet "Begin Android" English. The following tw

  • Summary of basic concepts and usage of GIT 2011-04-24

    Summary of basic concepts and usage of GIT guibin.beijing @ gmail.com GIT in the course of daily use, often wrong, such as inadvertently lost uncommitted data back version of the working directory is lost, and so on. After thinking that all these err

  • Summarize the basic concepts and usage of GIT 2011-04-24

    Summarize the basic concepts and usage of GIT guibin.beijing @ gmail.com In daily use GIT process, often wrong, such as inadvertently lost uncommitted data back version of the work lost when a directory, and so on. After thinking that all these error

  • JVM garbage collection mechanism and GC Adjustment 2010-03-29

    JVM garbage collection mechanism and GC Adjustment 1, GC Summary: Knowledge of why the JVM heap, said first JVM heap? JVM is a Java object heap space for activities, procedures, objects in the class from which the allocation of space, its stores are

  • [10Minutes] closure: basic concepts 2010-02-09

    Closure: Basic Concepts Closure can contain free (unbound) variable block; these variables are not in this block of code, or any definition of the global context, but the definition of the code block in the definition of the environment. "Closure&quo

  • Oracle DDL, DML, DCL, TCL basic concepts 2010-03-03

    Oracle DDL, DML, DCL, TCL basic concepts DDL Data Definition Language (DDL) statements are used to define the database structure or schema. Some examples: CREATE - to create objects in the database ALTER - alters the structure of the database DROP -

  • flash sports some of the basic concepts of law 2010-04-03

    The activities of the cartoon image, unlike other films, as a direct shot with the film movement of the object and objective, but the movement of objects through objective observation, analysis, research, performance practice with animation (mostly e

  • Core Series JavaScript Chapter 2 Basic Concepts 2010-04-03

    Chapter II Basic Concepts JavaScript in this chapter will focus on basic concepts, these concepts with the traditional language is a more substantial difference, to do so for a separate Zhuanmenmiaoshu Zhang, Li Jie of this chapter, the concept of th