As you all know that there are many programming languages such as c, c++, Java and much more. These programming languages have their own compiler and execution engine. Compiler task is to direct programmer about the accuracy of the code and convert them either into machine language or another language. Execution engine task is executing the program. Java Virtual Machine (JVM) can be called as the running engine or the execution engine for the Java language. So here in this post Webgranth present some nitty—gritty of JVM.
Java Virtual Machine is an executing program that is only developed to run Java Programs. JVM is packed with very advanced features that are future technology independent. This framework is created that mainly focus security, compatibility and efficient delivery performance. Although having such advanced features JVM still has some disadvantages too such as execution time is low and much more. To know more about Java Virtual Machine this post features almost every aspects of JVM in details manner, read it, and discover some new facts.
Overview of Java Virtual Machine
Java Virtual Machine (JVM) is the execution program that executes the compiled file of java program called bytecode and produce specified results. JVM provides a Java runtime system that support exception handling which provides detail information of debugging code. JVM is compatible with almost all operating system and can also be implemented independently on any hardware.
Java bytecode is the intermediate language that is compiled form of a Java program text file or a java source code file and is compiled mostly through Java Compiler or another compiling program. Ada source can also be converted to Java bytecode and run through JVM
Java runtime Environment is the framework that comprises Standard Java Class Library, Compiler to create bytecode and JVM. When Java Virtual Machine comes with most of the hardware and Software that make Java program write once and execute anywhere.
Execution Architecture of Java Virtual Machine
At first Java Program is created in simple text format. Then this file is compiled to be converted to bytecode. The bytecode is passed through the Java Virtual Machine for execution. Then Java Virtual Machine converts the bytecode into machine language that can be understood by a computing device and the Output is generated. Suppose there is a program for adding two numbers, named as “add.java”. When it is compiled then it is converted to “add. class”. This “add. Class” is passed through the JVM and output/ machine language is generated. Then JVM interact with the operating system to present the output.
Features of Java Virtual Machine
Java Virtual Machine executes any source code file
Java Virtual Machine can run many different language programs despite of Java syntactical code. JVM does not support built in Dynamic typed language but JVM can use to work as compiler dynamic type language. JVM instruction set is statically typed but still support dynamic typed language.
Java Virtual Machine Uses Heap memory
Java Virtual Machine support heap memory, which is used for dynamic memory allocation for object initialization, defining classes, Meta data and garbage collection for objects. Here Heap memory is divided into part. First part called as young generation for controlling object handling such as creating and disposing object. Second part called permanent generation for handling class such defining class and metadata.
Java Virtual Machine support security for Remote Code Execution
The framework of Java Virtual Machine is designed in such a way that remote application can be securely executed. This is designed to do secure execution of no trusted remote file. This concept is followed for execution of Java Applet. For example, Applet is executed at our browser then it cannot access the file on the execution system. To have access permission the deliver should need to purchase a certificate which signifies the applet as safe and that Applet can access the local file.
Java Virtual Machine Supportive Instruction
Java Virtual Machine support various instruction sets that are given below
- Arithmetic instruction set: JVM can interpret the arithmetic set of instruction such as multiplication, addition, division and subtraction.
- Type conversion: JVM support implicit/explicit type conversion and type promotion such as from int to double or from int to short int.
- Operand Management: JVM manages operand through stack memory allocation using push and pop operation.
- Transferring control: Java Virtual Machine support branching of control such as jumping, breaking the loop, and returns from the method.
- Defining subroutine: In Java Virtual Machine, creating subprogram such as function and procedure is supported.
- Concurrency control: A concept of threading is included in Java Virtual Machine for controlling different method concurrently.
Java Virtual Machine Support Bytecode verification
Java Virtual Machine provides security to host computer by verifying the bytecode. It is considered that bytecode can have the potential to destroy the host computer data and program. JVM checks the following aspects of bytecode:-
- Branching code: JVM verifies the branching information such as jumping code point to the correct location of memory. If branching code jump to the important file then there is danger of corruption to the file.
- Declared variables are initialized and type safe: In Java, the objects are dynamically initialized that states that at the time of execution Object can acquire space in memory. However, if that objects are not being used in the whole program that means there is a depletion of memory which is disadvantageous. To avoid this JVM sent the warning message.
- Access modifier: Java Virtual Machine support access modifier for Private, Public and friend to ensure that byte code should not access the different file with another access specification so that breaching security premises can be avoided.
Advantage and Disadvantage of Java Virtual Machine
- Cross Platform: Java Virtual Machine is the platform independent that means it can be installed on any operating system such as Windows, Linux and others results in transforming bytecode regardless of hardware and Operating system to be executed.
- Security: Java Virtual Machine framework is designed in such a way to provide security to host computer in terms of their data and program.
- Speed: The program run on the Java Virtual Machine takes longer to execute as compare to C++ compiler.
- Cannot experience Platform Specific features: Java Virtual Machine is developed to be compatible with multiple Operating Systems. As we know that all the operating systems have some special features and that specific features cannot be viewed for example look of the theme will be same.
- Java Program cannot run over all the operating system: This is true that JVM can be installed on all the operating system but it is also known that all operating system are not come with pre installed JVM so this is the great disadvantage that we need to install JVM first manually then we can use Java program.
Hope that you are aware a lot about Java Virtual Machine. If you find any confusion in this post, please share with us through the comment section given below. So that we can help you in clearing picture about JVM . if you want to share some new concept you are most welcome to drop your content at Guest Page. For new update please be connected thank you.