0% found this document useful (0 votes)
16 views8 pages

Java Virtual Machine: Lecturer: Mr. S. Mavuchi

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views8 pages

Java Virtual Machine: Lecturer: Mr. S. Mavuchi

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Java Virtual Machine

Lecturer: Mr. S. Mavuchi.


Introduction to JVM
Definition:
• The Java Virtual Machine (JVM) is a virtual machine that enables a
computer to run Java programs.
• It is the cornerstone of Java’s “write once, run anywhere” capability.

Role:
• The JVM executes Java bytecode, which is compiled from Java source
code, and translates it into machine code for the host system
The JVM
JVM Architecture
Class Loader Subsystem

Loads class files into the JVM. It performs three main functions:
loading, linking, and initialization.

Phases:
• Loading: Reads the .class file and generates the corresponding binary data.

• Linking: Combines the binary data into the runtime state of the JVM.

• Initialization: Initializes static variables and executes static blocks.


Runtime Data Areas
Method Area:
• Stores class structures like metadata, constant runtime pool, and the code for methods 1.
Heap:
• The runtime data area from which memory for all class instances and arrays is allocated.
Stack:
• Stores frames, which hold local variables and partial results, and plays a part in method
invocation and return.
Program Counter (PC) Register:
• Contains the address of the JVM instruction currently being executed.
Native Method Stack:
• Contains all the native methods used in the application.
Execution Engine
Interpreter:
• Reads and executes bytecode instructions one at a time.
Just-In-Time (JIT) Compiler:
• Compiles bytecode into native machine code at runtime for better
performance.
Garbage Collector:
• Automatically manages memory by reclaiming memory used by
objects that are no longer reachable.
JVM Operations
Class Loading:
• The process of loading class files into the JVM, involving the class
loader subsystem.
Bytecode Execution:
• The execution engine interprets or compiles bytecode into machine
code.
Memory Management:
• The JVM manages memory through the heap and stack, and performs
garbage collection to free up unused memory.
JVM Languages
Support for Multiple Languages:
• Besides Java, the JVM supports other languages like
• Scala
• Kotlin
• Groovy, which also compile to Java bytecode.

You might also like