EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login

What is JVM?

Home » Software Development » Software Development Tutorials » Java Tutorial » What is JVM?

What is JVM?

Introduction to JVM

Java Virtual Machine (JVM) is a powerful engine that offers a Java Software or application runtime environment. Java bytecode is converted into the language of your machine. JVM’s a Java Run Environmental (JRE) portion. The compiler produces machine code for a particular system in other programming languages. Bytecode is an intermediate language between the host and the Java source.

Understanding

Java is known as platform-independent due to the Java Virtual Machine. When a submission is done into different computers with the different operating systems having JVM, the bytecode is interpreted into machine-level language by JVM. To be precise, JVM programs are written in C Programming Language, while JVM is independent of the operating system. It is a key component of Java Architecture.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Apart from all this, it is responsible for assigning the essential memory required by a Java program. It is also responsible for prohibiting the memory space.

What does it do?

The crucial operations which JVM performs are as follows:

  • Code Loading
  • Code Verifying
  • Code Execution
  • Runtime environment provision

Apart from all this, it rolls out classifications for Class file format, Memory area, Garbage-collected heap, Register set, Fatal error reporting, etc.

JVM Architecture

Let’s get some key insights about the internal architecture of JVM which comprises of:

1. Classloader

It is a subsystem of JVM used to load class files. While running the java program it first gets loaded by the classloader. The three classloaders which Java includes are as follows:

Popular Course in this category
Java Training (40 Courses, 29 Projects, 4 Quizzes)40 Online Courses | 29 Hands-on Projects | 285+ Hours | Verifiable Certificate of Completion | Lifetime Access | 4 Quizzes with Solutions
4.8 (8,455 ratings)
Course Price

View Course

Related Courses
JavaScript Training Program (39 Courses, 23 Projects, 4 Quizzes)jQuery Training (8 Courses, 5 Projects)Free Java Online CourseJavaFX Training (1 Courses)

a. Bootstrap ClassLoader: It’s the superclass of Extension classloader. It assists in loading the rt.jar files that carry all the class files.

b. Extension ClassLoader: It is the parent classloader of System classloader and child classloader of Bootstrap. The jar files inside $JAVA_HOME/jre/lib/ext directory can be extracted through the Extension ClassLoader.

C. System/Application ClassLoader: It is the child of the Extension classloader also known as Application classloader. The class files from the classpath can be extracted through it. The Classpath, which is set to the current directory, by default can be changed by using ‘-cp’ or ‘-classpath’ switch.

2. Class (Method) Area

The pre-class structures like field and method data, runtime constant pool, and the code for methods are stored in the

Class (Method) Area. It is a memory that is created on JVM startup and is shared among all Threads like Heap.

3. Heap

The objects are assigned through this useful runtime data area. It is a memory place storing objects along with its instance variables. Whenever an object is created in Java, it goes into the heap – the area of memory.

4. Stack

Along with storing frames, Java Stack holds variables and partial results. It also plays a pivotal role in method, invocation, and return. Every individual thread consists of its private JVM stack, created at the same time as thread. Whenever a method escalates, a new frame is generated and is shattered when the method invocation gets completed.

5. Program Counter (PC) Register

The PC register contains the JVM instruction address at the time of its execution. Keeping track of instructions, it has value for every instruction which is undefined for the native methods.

6. Native Method Stack

The native procedures used in the applications are part of the Native Method Stack. These methods are written in languages other than Java. Associated with each thread, JVM implementations can’t rely on conventional stacks and cannot load native methods. To be precise, it is similar to stack but used for native methods.

7. Engine

Being the key aspect of JVM, it communicates with its various memory areas. This includes:

a. Garbage Collector: This plays a vital role in the JVM’s dynamic memory management system. The memory which is occupied and no longer referenced by any of the reachable Java objects is released through the Garbage Collector.

b. Interpreter: It executes the instructions after reading the bytecode stream.

c. Just-In-Time (JIT) compiler: Enabling performance enhancement, JIT compiler compiles parts of the bytecode with similar functionality at the same time. It helps in reducing the amount of time needed for the compilation process.

8. Java Native Interface (JNI)

The applications scripted in other languages i.e. C, C++, Assembly, etc. can be connected to, through an interface delivered by JNI. JNI framework is used by Java to interact with OS libraries or to send output to the Console.

What is the use of JVM?

The JVM has two primary functions: to allow Java programs to run on any device or operating system (known as the “Write once, run anywhere” principle), and to manage and optimize program memory.

Advantages and Disadvantages

Java Programs are aptly executed through JVM. Bytecode – an intermediate language is used to compile Java programs and then executed through JVM. Every individual program which is being compiled into bytecode can be performed by any platform fueled by JVM. This enables Java software more effective as well as compatible as per the various computing platforms are concerned. The JVM has a few notable advantages and disadvantages that any developer should weigh carefully before investing in Java development.

1. Security

Through JVM’s security knacks, the programmers can effectively write high-end secured Java programs. It empowers the Operating System resources to identify the malicious software and also helps in its prevention accordingly.

2. Performance

Java programs which run on a JVM are likely to offer slower execution as compared to the programs that are written in C++. This is due to the code optimization which excessively relies on different system-specific features. Also, the Java bytecode cannot be optimized for a specific hardware set, as it is system-neutral.

3. Correctness

Correct is the program, which performs effectively and meets a user’s expectation to the fullest. JVM’s in-built features enable it to operate correctly and free of errors.

Why should we use JVM?

In spite of having Java syntactical code, JVM can run on various different language programs. Few of the reasons why it is so widely used and why to use it across different platforms are listed below:

It uses heap memory: Heap memory is a core component that is used for dynamic memory allocation for defining classes and object initialization and since JVM supports heap memory, it has wide acceptance.

Providing security for Remote code location: JVM framework is designed in such a manner that remote application is easily executed. This theory is followed for executing the Java Applet.

Conclusion

The fact that JVM works on multiple operating systems, gives it a thumbs-up in the technology domain. Using it on Windows, Linux, and other OS’s, it is enabled to transform bytecode regardless of the hardware and the OS that is to be executed. In addition, its ability to offer security to the host computer by securing their data and program is another reason why JVM has been so successful in the past and continues to be dominant in the future.

Recommended Articles

This has been a guide to What is a JVM(Java Virtual Machine). Here we discuss the basic concepts with the list of Architecture and uses of JVM. You can also go through our other suggested articles to learn more –

  1. Data Types in Java
  2. JRE vs JVM
  3. ClassLoader in Java
  4. Stack vs Heap Memory

Java Training (40 Courses, 29 Projects, 4 Quizzes)

40 Online Courses

29 Hands-on Projects

285+ Hours

Verifiable Certificate of Completion

Lifetime Access

4 Quizzes with Solutions

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Java Tutorial
  • Basic
    • What is Java?
    • What is JNDI in Java
    • What is JNI in Java
    • What is Java Interface
    • What is Java SE
    • What is JavaBeans
    • Install JDK
    • Java Programming Language Features
    • Applications of Java
    • Career in Java
    • Versions of Java
    • Careers as Java Developer
    • Java Virtual Machine
    • Java GUI Framework
    • Java Packages
    • Java Package Example
    • Default Package in Java
    • Variables in Java
    • Instance Variable in Java
    • Object in Java
    • Java Commands
    • Iterator in Java
    • Java Booleans
    • Conversion in Java
    • Type Conversion in Java
    • String in Java
    • What is JDK
    • What is JVM
    • What is J2EE
    • RMI Architecture
    • Java Literals
    • Data Types in Java
    • Primitive Data Types in Java
    • Enumset in Java
    • Cheat Sheet Java
    • IntelliJ Cheat Sheet
  • Frameworks
    • Best Java Compilers
    • Frameworks In Java
    • Testing Frameworks for Java
    • Java Monitoring Tool
    • Best Java IDE
    • Java Compilers
    • Java Tools
    • Java Deployment Tools
    • Types of Memory in Java
    • Java References
    • Java Type Inference
    • Java Boolean to String
    • Java String to Float
    • java.net Package
    • Java Formatter
  • Operators
    • Arithmetic Operators in Java
    • Unary Operators in Java
    • Logical Operators in Java
    • Comparison Operators in Java
    • Assignment Operators in Java
    • Java String Operators
    • Conditional Operator in Java
    • Boolean operators in Java
  • Keywords
    • Java Keywords
    • this Keyword in Java
    • Static Keyword in Java
    • Native keyword in Java
    • Throw Keyword in Java
    • Throws Keyword in Java
    • What is public in Java?
    • Private in Java
    • Protected Keyword in Java
    • Final Keyword in Java
  • Control statements
    • Control Statement in Java
    • Else-If Statement in Java
    • Nested if Statements in Java
    • Continue Statement in Java
    • Break Statement in Java
    • Case Statement in Java
  • Loops
    • Loops in Java Programming
    • For Loop in Java
    • While Loop in Java
    • do-while loop in Java
    • For-Each loop in Java
    • Nested Loop in Java
  • Inheritance
    • Inheritance in Java
    • Single Inheritance in Java
    • Multilevel Inheritance in Java
    • Hierarchical Inheritance in Java
    • Hybrid Inheritance in Java
  • Constructor and destructor
    • Constructor and Destructor in Java
    • Constructor in Java
    • Destructor in Java
    • Copy Constructor In Java
    • Static Constructor in Java
    • Private Constructor in Java
  • Array
    • Arrays in Java Programming
    • 2D Arrays in Java
    • 3D Arrays in Java
    • Multidimensional Array in Java
    • Array Methods in Java
    • Print 2D Array in Java
    • Print Array in Java
    • String Array in Java
    • Associative Array in Java
    • Dynamic Array in Java
    • Java Array Iterator
    • Java array.push
  • Sorting
    • Sorting in Java
    • Sorting Algorithms in Java
    • Merge Sorting Algorithms in Java
    • Quick Sorting Algorithms in Java
    • Selection Sort In Java
    • Heap Sort In Java
    • Bubble Sort in Java
    • Merge Sort In Java
    • Quick Sort in Java
    • Insertion Sort in Java
    • Program for Merge Sort in Java
  • Functions
    • String Functions in java
    • Math Functions in Java
    • Hashing Function in Java
    • Regular Expressions in Java
    • Recursion in Java
    • Java Callback Function
    • Java Call by Value
    • Java Call by Reference
    • HashMap in Java
    • Java String Concatenation
    • Java String Equals
    • Virtual Function in Java
    • Java newInstance()
    • split() Function in Java
    • trim() Function in Java
    • Replace() Function in Java
    • substring() Function in Java
    • Strictfp in Java
    • String Reverse Function in Java
    • Java String getBytes
    • Java Replace Char in String
    • Shuffle() in Java
    • addAll() in Java
    • FileWriter in Java
    • Java Stream Filter
    • Java FileInputStream
    • replaceAll() in Java
    • repaint in Java
    • copy() in Java
    • Java max()
    • Java min()
    • Java Timestamp
    • Java URLConnection
    • Java StringJoiner
    • Java KeyStore
    • Java InetAddress
    • Java getMethod()
    • swap() in Java
    • Deadlock in Java
    • Range in Java
    • Java Repository
    • Java Dictionary
    • Calculator in Java
    • Mutable String in Java
    • Mutable vs Immutable Java
    • Native Methods in Java
    • StringBuffer Class in Java
    • String Class in Java
    • Java URL Class
    • Java Vector Class
  • Polymorphism
    • What is Polymorphism
    • Polymorphism in Java
    • Runtime Polymorphism in Java
    • Overloading and Overriding in Java
    • Overloading in Java
    • Method Overloading in Java
    • Function Overloading in Java
    • Overriding in Java
    • Method Overriding in Java
    • Final Keyword in Java
    • Super Keyword in Java
    • instanceOf in Java
    • Java Authenticator
    • Java Alias
  • Collections
    • What is TreeMap in Java?
    • Sorting in Collection
    • Java Collections Class
    • Hashtable in Java
    • Java EnumMap
    • Java LinkedHashMap
    • Reverse Linked List in Java
    • LinkedList in Java
  • Date Time
    • java.util.Date
    • Java Clock
    • Java Instant
    • Java LocalTime
    • Java ZoneId
    • Java ZoneOffset
    • Java varargs
    • Java LocalDate
    • Java OffsetDateTime
    • Java LocalDateTime
    • Java Duration
    • Java DayOfWeek
    • Java Period
    • Timer in Java
    • Java TimeZone
  • Advanced
    • Methods in Java
    • Inner Class in Java
    • Anonymous Inner Class in Java
    • Java Stack Methods
    • Java Static Nested Class
    • Synchronized Block in Java
    • Static Synchronization in Java
    • Abstract Class in Java
    • Access Modifiers in Java
    • Non Access Modifiers in Java
    • Bit Manipulation in Java
    • Encapsulation in Java
    • Singleton Class in Java
    • Wrapper Class in Java
    • Nested Class in Java
    • Java Matcher
    • Java Pattern Class
    • Java File Class
    • Final Class in Java
    • Stack Class in Java
    • Anonymous Class in Java
    • StringBuilder Class in Java
    • StringBuffer in Java
    • Java Directories
    • JSON in Java
    • Object Class in Java
    • What is Multithreading in java
    • Java Thread Priority
    • Daemon Thread in Java
    • Java Thread Pool
    • Java ThreadLocal
    • Association in Java
    • Queue in Java
    • Functional Programming in Java
    • ClassLoader in Java
    • Interface in Java
    • Functional Interface in Java
    • Java Queue Interface
    • Collection Interface in Java
    • Object Cloning in Java
    • Java.net URI
    • Java Assertion
    • Vector in Java
    • Applets in Java
    • Template in Java
    • Java Shutdown Hook
    • 2D Graphics in Java
    • Autoboxing and Unboxing in Java
    • Comparable in Java Example
    • Java Annotations
    • Java User Input
    • Serialization in Java
    • Dynamic Binding in Java
    • Java Parse String
    • Java Adapter Classes
    • Immutable Class in Java
    • String Initialization in Java
    • String Manipulation in Java
    • ThreadGroup in Java
    • Java Iterate Map
    • Java IO
    • Java?OutputStreamWriter
    • DataInputStream in Java
    • Java BufferedReader
    • Java BufferedWriter
    • Java BufferedInputStream
    • Java ByteArrayInputStream
    • Java ByteArrayOutputStream
    • Java RandomAcessFile
    • Java PrintStream
    • Java PrintWriter
    • Java URLEncoder
    • Java Scanner Class
    • Java Console
    • Java Runtime class
    • Java Base64
    • Java Base64 Encoding
    • Java Base64?Decode
    • Finalize in Java
    • Java Parallel Stream
    • Java Getter Setter
    • Set Interface in Java
    • How to Connect Database in Java
    • How to Create Webservice in Java
    • Composition in Java
    • BinarySearch() in Java
    • Exception Handling in Java
    • Java NullPointerException
    • Java NoSuchElementException
    • Java ConcurrentModificationException
    • Java ArithmeticException
    • Java IOException
    • Java RuntimeException
    • NumberFormatException in Java
    • Java ArrayIndexOutOfBoundsException
    • Java ClassNotFoundException
    • Java FileNotFoundException
    • Java InterruptedException
    • Finally in Java
    • Java Default Method
    • Java Locale
    • Tuples in Java
    • Java ServerSocket
    • Java Lambda Expressions
    • Java DatagramSocket
    • Java Animation
  • MISc
    • What is Synchronization in Java
    • What is Concurrency in Java
    • What is Design Pattern in Java
    • What is Generics in Java
    • What is API in Java
    • What is a Binary Tree in Java
    • What is Java Garbage Collector
    • What is Java Inheritance
    • Thread Life cycle in Java
    • Object Oriented Programming in Java
    • Java App Development
    • Java Naming Conventions
    • Java hashCode()
    • Java Transient
    • JSTL In Java
    • Comparable in Java 
    • Aggregation in Java
    • EJB in Java
    • @deprecated in Java
    • Java @Inherited
    • @SuppressWarnings in Java
    • Java @Override
  • Programs
    • Patterns in Java
    • Star Patterns in Java
    • Number Patterns in Java
    • Swapping in Java
    • Factorial in Java
    • Fibonacci Series in Java
    • Reverse Number in Java
    • Palindrome in Java
    • Armstrong Number in Java
    • Squares in Java
    • Square Root in Java
    • Special Number in Java
    • Anagram Program in Java
    • Strong Number in Java
    • Random Number Generator in Java
    • Matrix Multiplication in Java
    • Socket Programming in Java
    • Prime Numbers in Java
    • String Comparison in Java
    • Leap Year Program in Java
    • Reverse String in Java
    • Design Patterns in Java
    • Happy Numbers in Java
  • Interview Questions
    • Java Interview Questions
    • Java Inheritance Interview Questions
    • Java EE Interview Questions
    • Java Developer Interview Questions
    • Java Collection Interview Questions
    • Java Interview Question on Multithreading
    • Java String interview question
    • Java Testing Interview Questions
    • Java Multi-threading Interview Questions
    • Multithreading Interview Questions in Java
    • Oops Java Interview Questions
    • Java Spring Interview Questions
    • Data Structure Java Interview Questions
    • Java Web Services Interview Questions

Related Courses

Java Course

JavaScript Certification Course

jQuery Training Course

Java Training Courses

Free Java Training Courses

JavaFX Training

Java Training Course

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

© 2020 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you
Book Your One Instructor : One Learner Free Class

Let’s Get Started

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

Special Offer - Java Training (40 Courses, 29 Projects, 4 Quizzes) Learn More