A Java virtual machine is an essential component that performs special types of tasks.

  1. Loading of code
  2. Verification of code
  3. Executing the code
  4. Providing a runtime environment for the users

All these functions take different forms of the memory structure. These data structures are:

  • Heap
  • Stack
  • 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.



Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram