SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
JAVA ROADMAP
JVM Architecture – How It Works
Introduction
Java, a widely used programming language known for its versatility and
reliability, owes much of its power to the Java Virtual Machine (JVM)
Architecture. Let’s examine the JVM’s function in executing Java programs
and how it enables the concept of “Write Once, Run Anywhere” (WORA).
Definition Of JVM
The Java Virtual Machine, commonly referred to as JVM, is a virtual computer
that runs Java code. It acts as a translator between the computer’s native
language and your Java code. Consider it as a skilled interpreter who can
translate your words so that speakers of many languages understand you.
Importance Of JVM In Running Java Applications
The JVM Architecture
plays a vital role in running Java applications, offering benefits that make Java
widely applicable. Its benefits include:
1. Portability
JVM’s magic lies in its ability to make Java code portable across different
systems. It’s like a universal charger that allows you to plug in your electronic
devices, such as smartphones, tablets, or laptops, regardless of the
manufacturer. The charger handles the voltage and power requirements,
making it possible to use your devices worldwide without needing different
chargers for each country.
2. Memory Management in JVM Architecture
JVM takes care of memory management, ensuring your Java application runs
smoothly. Consider a closet organizer that optimizes space utilization by
intelligently arranging clothes, shoes, and accessories. Similarly, the JVM
efficiently allocates and releases memory for objects, keeping your program’s
memory usage in check and preventing memory-related issues.
3. Exception Handling in JVM Architecture
JVM acts as a problem solver, dealing with errors that occur during program
execution. Think of it as a safety net during a trapeze performance. If a
trapeze artist loses grip and falls, the net catches them, preventing a
disastrous outcome. Similarly, JVM detects errors or exceptions in your code
and gracefully handles them, preventing your program from crashing and
helping you identify and resolve issues.
WORA And Its Relation To JVM Architecture
WORA, or “Write Once, Run Anywhere,” is a key advantage of Java, made
possible by the JVM Architecture. Imagine writing a letter in your native
language and being able to share it with people around the world who speak
different languages. The recipients use their respective translators to
understand your message. Similarly, the JVM serves as a translator, enabling
Java code to be written once and run on any system with a compatible JVM.
The JVM simplifies running Java programs on different systems. It’s like a
universal remote that works with any TV, saving you from having multiple
remotes for different TVs.
JVM Architecture
The JVM Architecture is like a smart assistant that helps your computer
understand and execute Java programs. Let’s explore its architecture, which
consists of three key parts:
1. Class Loader
The class loader is like a librarian that finds and organizes the Java classes
your program needs, making sure everything is ready to go.
2. Runtime Data Area
The runtime data area serves as memory storage for different program
execution components, similar to a workspace that has multiple divisions.
1. Method Area
2. Heap Area
3. Stack Area
4. PC Register
5. Native Method Stack Area
3. Execution Engine
The execution engine acts as a skilled translator, converting your Java code
into a language that your computer can understand and execute. It does this
through two methods:
1. Interpreter
2. JIT Compiler
Compilation of .java files and creation of .class files
When you write Java code in a .java file, it’s in a human-readable form. The
process of transforming this code into bytecode is similar to compiling a
document into a PDF format. The Java compiler (javac) compiles the .java file
and generates bytecode instructions that can be understood by the JVM.
These bytecode instructions are stored in .class files, which contain the binary
representation of your code.
Steps involved in running .class files:
When you run a Java program, the JVM takes over the execution process.
Here are the steps involved:
1. Class Loading: The JVM’s class loader locates and loads the required
.class files into memory.
2. Bytecode Verification: The bytecode verifier ensures that the
bytecode is valid and doesn’t violate any security rules. It’s like a
security checkpoint👮💼 that scans your luggage at the airport to
ensure there are no prohibited items.
3. Execution: The JVM’s execution engine interprets the bytecode
instructions or dynamically compiles them into machine code using
the JIT compiler. The bytecode instructions are executed, and the
program’s logic is carried out.
4. Memory Management: The JVM manages memory allocation and
deallocation. It automatically handles memory usage, freeing up
memory occupied by objects that are no longer needed.
5. Exception Handling: The JVM detects and handles exceptions that
occur during program execution. It ensures that your program
doesn’t crash when unexpected situations arise, just like a safety net
that catches you when you stumble.
Now let’s deep dive into the working and functioning of JVM i.e. JVM
Architecture.
ClassLoader Subsystem In JVM Architecture
1. Introduction
Have you ever wondered how Java programs easily load and run many
classes? The Class Loader Subsystem, an important component of the Java
Virtual Machine (JVM), holds the key to the answer. Let’s explore the Class
Loader Subsystem’s operations, understand its function in loading classes,
and inspect its key components.
2. Understanding the ClassLoader Subsystem
Consider the Class Loader Subsystem as your trusted friend who helps in
finding and loading the classes your Java program requires. Similar to a
diligent librarian, it finds the necessary class files and brings them into
memory so they are available for use. When your program needs the right
classes, the Class Loader Subsystem ensures that they are easily available.
3. Components of the ClassLoader Subsystem:
The Class Loader Subsystem consists of different components, each playing a
crucial role in the class loading process. Let’s explore them one by one:
1. Bootstrap Class Loader:
This is like the superhero of class loaders, responsible for loading the core
Java classes that are part of the Java Development Kit (JDK). It’s the first
class loader that comes into action when the JVM starts up. Just as a
superhero lays the foundation for a story, the Bootstrap Class Loader provides
the essential building blocks for your Java programs.
2. Extension Class Loader:
Imagine you have some additional modules or libraries that enhance the
functionality of your Java program. The Extension Class Loader helps in
loading these extra modules, extending the capabilities of the core Java
classes. It’s like a friendly assistant who fetches the special tools you need to
enhance your work.
3. System/Application Class Loader:
Now, think of the System/Application Class Loader as your personal courier
service. It delivers the classes specific to your application, including the ones
you’ve created, to the JVM. This class loader looks into the classpath of your
application and ensures that all your custom classes are loaded correctly.
VISIT
BLOG.GEEKSTER.IN
FOR THE REMAINING
QUESTIONS

More Related Content

What's hot (20)

PPSX
Screen orientations in android
manjakannar
 
PPTX
Principles of programming
Rob Paok
 
PPT
1.1 The nature of software.ppt
JAYAPRIYAR7
 
PPTX
Research issues in object oriented software testing
Anshul Vinayak
 
PPTX
Software Testing and Debugging
university of education,Lahore
 
PDF
JAVA PPT Part-1 BY ADI.pdf
Prof. Dr. K. Adisesha
 
PPTX
Java basics and java variables
Pushpendra Tyagi
 
PPT
Chapter_03.ppt
oluobes
 
PPTX
Type checking in compiler design
Sudip Singh
 
PPS
Coding Best Practices
mh_azad
 
PDF
Agile Methodology - Software Engineering
Purvik Rana
 
PPT
System engineering
Dr.M.Karthika parthasarathy
 
PPTX
FDD (Feature Driven Development)
urumisama
 
PPSX
Principles of Software testing
Md Mamunur Rashid
 
PPTX
Software maintenance ppt
Anas Usman
 
PPTX
Lecture 01
Rana Ali
 
PDF
Python Numpy Source Codes
Amarjeetsingh Thakur
 
PDF
Calidad de Software
AnaMelba MH
 
PPT
Ian Sommerville, Software Engineering, 9th Edition Ch1
Mohammed Romi
 
PPTX
Introduction to system programming
sonalikharade3
 
Screen orientations in android
manjakannar
 
Principles of programming
Rob Paok
 
1.1 The nature of software.ppt
JAYAPRIYAR7
 
Research issues in object oriented software testing
Anshul Vinayak
 
Software Testing and Debugging
university of education,Lahore
 
JAVA PPT Part-1 BY ADI.pdf
Prof. Dr. K. Adisesha
 
Java basics and java variables
Pushpendra Tyagi
 
Chapter_03.ppt
oluobes
 
Type checking in compiler design
Sudip Singh
 
Coding Best Practices
mh_azad
 
Agile Methodology - Software Engineering
Purvik Rana
 
System engineering
Dr.M.Karthika parthasarathy
 
FDD (Feature Driven Development)
urumisama
 
Principles of Software testing
Md Mamunur Rashid
 
Software maintenance ppt
Anas Usman
 
Lecture 01
Rana Ali
 
Python Numpy Source Codes
Amarjeetsingh Thakur
 
Calidad de Software
AnaMelba MH
 
Ian Sommerville, Software Engineering, 9th Edition Ch1
Mohammed Romi
 
Introduction to system programming
sonalikharade3
 

Similar to JVM Architecture – How It Works.pdf (20)

PDF
Java Virtual Machine - Internal Architecture
subnesh
 
PPT
Java-java virtual machine
Surbhi Panhalkar
 
PDF
Jvm internal detail
Mohammad Faizan
 
PPTX
JVM.pptx
ParvathiPPSGRKCW
 
PPTX
Lecture java variable , data type, token
ChandrashekharSingh859453
 
PPTX
Java Virtual Machine (JVM) and just in time compilation
ArunKumarPandey43
 
DOCX
Java JDK.docx
Bornali Das
 
PDF
Inside JVM
Chinh Ngo Nguyen
 
PDF
An Introduction to Java Compiler and Runtime
Omar Bashir
 
PPS
Introduction to Java
Ankita Totala
 
PPTX
Mobile Application Development- Configuration and Android Installation
Dr. Chandrakant Divate
 
PPTX
Java byte code & virtual machine
Laxman Puri
 
PPTX
Introduction to java
Sandeep Rawat
 
PPT
Java14
aiter2002
 
PPTX
Java Programming Environment,JDK,JRE,JVM.pptx
sonalipatil225940
 
PPTX
Java byte code presentation
Mahnoor Hashmi
 
PPTX
Core Java Basics
Sujit Pathak
 
PPTX
Java virtual machine
Nikhil Sharma
 
Java Virtual Machine - Internal Architecture
subnesh
 
Java-java virtual machine
Surbhi Panhalkar
 
Jvm internal detail
Mohammad Faizan
 
Lecture java variable , data type, token
ChandrashekharSingh859453
 
Java Virtual Machine (JVM) and just in time compilation
ArunKumarPandey43
 
Java JDK.docx
Bornali Das
 
Inside JVM
Chinh Ngo Nguyen
 
An Introduction to Java Compiler and Runtime
Omar Bashir
 
Introduction to Java
Ankita Totala
 
Mobile Application Development- Configuration and Android Installation
Dr. Chandrakant Divate
 
Java byte code & virtual machine
Laxman Puri
 
Introduction to java
Sandeep Rawat
 
Java14
aiter2002
 
Java Programming Environment,JDK,JRE,JVM.pptx
sonalipatil225940
 
Java byte code presentation
Mahnoor Hashmi
 
Core Java Basics
Sujit Pathak
 
Java virtual machine
Nikhil Sharma
 
Ad

More from Geekster (7)

PDF
Constructors In Java – Unveiling Object Creation
Geekster
 
PDF
Java Polymorphism: Types And Examples (Geekster)
Geekster
 
PDF
Setting Up Java Environment | PDF
Geekster
 
PDF
Java Introduction | PDF
Geekster
 
PDF
OOps Interview questions.pdf
Geekster
 
PDF
2 Important Data Structure Interview Questions
Geekster
 
PDF
What are the 7 features of Python?pdf
Geekster
 
Constructors In Java – Unveiling Object Creation
Geekster
 
Java Polymorphism: Types And Examples (Geekster)
Geekster
 
Setting Up Java Environment | PDF
Geekster
 
Java Introduction | PDF
Geekster
 
OOps Interview questions.pdf
Geekster
 
2 Important Data Structure Interview Questions
Geekster
 
What are the 7 features of Python?pdf
Geekster
 
Ad

Recently uploaded (20)

PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
Dimensions of Societal Planning in Commonism
StefanMz
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 

JVM Architecture – How It Works.pdf

  • 1. JAVA ROADMAP JVM Architecture – How It Works Introduction Java, a widely used programming language known for its versatility and reliability, owes much of its power to the Java Virtual Machine (JVM) Architecture. Let’s examine the JVM’s function in executing Java programs and how it enables the concept of “Write Once, Run Anywhere” (WORA). Definition Of JVM The Java Virtual Machine, commonly referred to as JVM, is a virtual computer that runs Java code. It acts as a translator between the computer’s native language and your Java code. Consider it as a skilled interpreter who can translate your words so that speakers of many languages understand you. Importance Of JVM In Running Java Applications The JVM Architecture plays a vital role in running Java applications, offering benefits that make Java widely applicable. Its benefits include:
  • 2. 1. Portability JVM’s magic lies in its ability to make Java code portable across different systems. It’s like a universal charger that allows you to plug in your electronic devices, such as smartphones, tablets, or laptops, regardless of the manufacturer. The charger handles the voltage and power requirements, making it possible to use your devices worldwide without needing different chargers for each country. 2. Memory Management in JVM Architecture JVM takes care of memory management, ensuring your Java application runs smoothly. Consider a closet organizer that optimizes space utilization by intelligently arranging clothes, shoes, and accessories. Similarly, the JVM efficiently allocates and releases memory for objects, keeping your program’s memory usage in check and preventing memory-related issues. 3. Exception Handling in JVM Architecture JVM acts as a problem solver, dealing with errors that occur during program execution. Think of it as a safety net during a trapeze performance. If a trapeze artist loses grip and falls, the net catches them, preventing a disastrous outcome. Similarly, JVM detects errors or exceptions in your code and gracefully handles them, preventing your program from crashing and helping you identify and resolve issues. WORA And Its Relation To JVM Architecture WORA, or “Write Once, Run Anywhere,” is a key advantage of Java, made possible by the JVM Architecture. Imagine writing a letter in your native
  • 3. language and being able to share it with people around the world who speak different languages. The recipients use their respective translators to understand your message. Similarly, the JVM serves as a translator, enabling Java code to be written once and run on any system with a compatible JVM. The JVM simplifies running Java programs on different systems. It’s like a universal remote that works with any TV, saving you from having multiple remotes for different TVs. JVM Architecture The JVM Architecture is like a smart assistant that helps your computer understand and execute Java programs. Let’s explore its architecture, which consists of three key parts: 1. Class Loader The class loader is like a librarian that finds and organizes the Java classes your program needs, making sure everything is ready to go. 2. Runtime Data Area The runtime data area serves as memory storage for different program execution components, similar to a workspace that has multiple divisions. 1. Method Area 2. Heap Area 3. Stack Area 4. PC Register 5. Native Method Stack Area 3. Execution Engine The execution engine acts as a skilled translator, converting your Java code into a language that your computer can understand and execute. It does this through two methods:
  • 4. 1. Interpreter 2. JIT Compiler Compilation of .java files and creation of .class files When you write Java code in a .java file, it’s in a human-readable form. The process of transforming this code into bytecode is similar to compiling a document into a PDF format. The Java compiler (javac) compiles the .java file and generates bytecode instructions that can be understood by the JVM. These bytecode instructions are stored in .class files, which contain the binary representation of your code. Steps involved in running .class files: When you run a Java program, the JVM takes over the execution process. Here are the steps involved: 1. Class Loading: The JVM’s class loader locates and loads the required .class files into memory. 2. Bytecode Verification: The bytecode verifier ensures that the bytecode is valid and doesn’t violate any security rules. It’s like a
  • 5. security checkpoint👮💼 that scans your luggage at the airport to ensure there are no prohibited items. 3. Execution: The JVM’s execution engine interprets the bytecode instructions or dynamically compiles them into machine code using the JIT compiler. The bytecode instructions are executed, and the program’s logic is carried out. 4. Memory Management: The JVM manages memory allocation and deallocation. It automatically handles memory usage, freeing up memory occupied by objects that are no longer needed. 5. Exception Handling: The JVM detects and handles exceptions that occur during program execution. It ensures that your program doesn’t crash when unexpected situations arise, just like a safety net that catches you when you stumble. Now let’s deep dive into the working and functioning of JVM i.e. JVM Architecture. ClassLoader Subsystem In JVM Architecture 1. Introduction Have you ever wondered how Java programs easily load and run many classes? The Class Loader Subsystem, an important component of the Java Virtual Machine (JVM), holds the key to the answer. Let’s explore the Class Loader Subsystem’s operations, understand its function in loading classes, and inspect its key components. 2. Understanding the ClassLoader Subsystem Consider the Class Loader Subsystem as your trusted friend who helps in finding and loading the classes your Java program requires. Similar to a diligent librarian, it finds the necessary class files and brings them into memory so they are available for use. When your program needs the right classes, the Class Loader Subsystem ensures that they are easily available.
  • 6. 3. Components of the ClassLoader Subsystem: The Class Loader Subsystem consists of different components, each playing a crucial role in the class loading process. Let’s explore them one by one: 1. Bootstrap Class Loader: This is like the superhero of class loaders, responsible for loading the core Java classes that are part of the Java Development Kit (JDK). It’s the first class loader that comes into action when the JVM starts up. Just as a superhero lays the foundation for a story, the Bootstrap Class Loader provides the essential building blocks for your Java programs. 2. Extension Class Loader: Imagine you have some additional modules or libraries that enhance the functionality of your Java program. The Extension Class Loader helps in loading these extra modules, extending the capabilities of the core Java classes. It’s like a friendly assistant who fetches the special tools you need to enhance your work. 3. System/Application Class Loader: Now, think of the System/Application Class Loader as your personal courier service. It delivers the classes specific to your application, including the ones you’ve created, to the JVM. This class loader looks into the classpath of your application and ensures that all your custom classes are loaded correctly. VISIT BLOG.GEEKSTER.IN FOR THE REMAINING QUESTIONS