- A Java virtual machine is an essential component that performs special types of tasks.
- Loading of code
- Verification of code
- Executing the code
- Providing a runtime environment for the users
All these functions take different forms of the memory structure. These data structures are:
- Program Counter Register
- Native Method Stack
Let us discuss each of the above memory structures' characteristics:
Heap memory structure is usually implemented for allocating memory dynamically. Variables assigned with this type of memory structure can be allocated at runtime, but they have slow access to memory.
The stack memory structure is mostly implemented for providing static memory allocation. Programmers could make use of stack if they knew in advance how much memory needs to be allocated for the storage of data.
Program Counter Register: Programs are a set of instructions or orders feed to a computer for performing. These instructions are delivered to the processor by the program written by a human. The program counter register holds the address of the upcoming instructions to be executed.
Native methods form a stack that is primarily implemented to line up with your system calls as well as libraries scripted in different computer languages.