JVM is a program that converts Bytecode instructions into Machine code. The following figure shows the JVM architecture:
Now let us know about each part in JVM architecture:
Fig: JVM Architecture |
Class Loader:
In JVM class loader is a module. It will do the following tasks.
- Loads the .class file from hard disk into RAM.
- Verifies all the bytecode instructions, if any other code is found then it rejects the .class file.
- When all the byte code instructions are correct then it will allocate the required memory for the program.
Runtime Data Areas:
The memory allocated by class loader is called as Runtime Data Areas. There are 5 data areas:- Method Area
- Heap
- Java Stacks
- PC Registers
- Native Method Stacks
1. Method Area:
Class code, Method code, static variables and static blocks are also stored on method area.
2. Heap:
Objects are created on heap. It is a huge memory.
3. Java Stacks:
These are the memory areas where Java methods are executed. Java stacks are divided into frames and on each frame a separate method is executed.
4. PC Registers:
Register is a place where memory address is stored. PC Registers contain memory address of the next instruction to be executed by the processor.
No comments:
Post a Comment