Class loader sub system
First of all, it loads
the .class file.
Then it verifies whether all byte code instructions are proper or not. If it finds any instruction suspicion, the execution is rejected immediately.
If the byte instructions are proper, then it allocates necessary memory to execute the program. This memory is divided into 5 parts, called run time data access, which contains the data and results while running the program.
Method area: Stores the class code, code of the variables and code of the methods in the program.
Heap: Area where objects are created. Whenever jvm loads a class, a method and a heap area are immediately created in it.
Java stacks: Method code is stored on method area. But while running a method, it needs some more memory to store the data and results. This memory is allocated on java stacks. So these are the memory areas where java methods are executed. While executing methods, a separate frame will be created in the java stack, where the method is executed. Jvm uses a separate thread or process to execute each method.
PC (Program counter) registers: These are the registers (memory areas), which contain memory address of the instructions of the methods. If there are 3 methods, 3 pc registers will be used to track the instructions of the methods.
Native method stacks: Java methods are executed on java stacks. Similarly native methods (C/C++) are executed here.
Execution engine contains interpreter and JIT compiler which are responsible for converting the byte code instructions into a machine code.
Then it verifies whether all byte code instructions are proper or not. If it finds any instruction suspicion, the execution is rejected immediately.
If the byte instructions are proper, then it allocates necessary memory to execute the program. This memory is divided into 5 parts, called run time data access, which contains the data and results while running the program.
Method area: Stores the class code, code of the variables and code of the methods in the program.
Heap: Area where objects are created. Whenever jvm loads a class, a method and a heap area are immediately created in it.
Java stacks: Method code is stored on method area. But while running a method, it needs some more memory to store the data and results. This memory is allocated on java stacks. So these are the memory areas where java methods are executed. While executing methods, a separate frame will be created in the java stack, where the method is executed. Jvm uses a separate thread or process to execute each method.
PC (Program counter) registers: These are the registers (memory areas), which contain memory address of the instructions of the methods. If there are 3 methods, 3 pc registers will be used to track the instructions of the methods.
Native method stacks: Java methods are executed on java stacks. Similarly native methods (C/C++) are executed here.
Execution engine contains interpreter and JIT compiler which are responsible for converting the byte code instructions into a machine code.
No comments:
Post a Comment