Advantages and Disadvantages

 

Advantages:

Multiplatform: Because the Java virtual machine interprets/JITs the same bytecodes, the same Java binaries can run without modification on any platform that has a JVM.

Control: The JVM is in charge of several tasks: Memory management, exception handling, memory safe references, sandboxing, and other features are available.

 

Disadvantages:

Performance: Earlier JVMs had to interpret each Java bytecode, which made overall programme execution extremely slow. Anyway, since the release of Java HotSpot JIT, JVM performance has greatly improved, though a programme running on top of it will never perform as well as a programme written in a native programming language (C, C++, Rust, and so on).

Memory footprint: Regardless of how small your programme is, you will need to have the entire JVM loaded into your system (several Megabytes).

Memory footprint of an object: In native languages, your objects can live in the callstack and take up ZERO heap space. Java objects, on the other hand, are always stored in heap and have a pointer (reference in Java jargon) pointing to them. The size of the pointer is normally the same as the size of a pointer on the platform where the JVM is running, but Java 7 introduced "Compressed OOPS," which allows the system to have 32-bit pointers in 64-bit environments.

The primary advantage of Java JVM is code compatibility as it eases a programmer’s job to write code only once and run anywhere. Once the application is built it can be run on any device that has JVM. Apart from this it provides security. A program running in virtual machine is likely to suffer less from any malicious activity.

Speed and its platform specific features can be considered as the disadvantages of JVM. As a program needs to be translated from source code to byte code and then from byte code to executable code, the speed of execution of a program is decreased when compared to other high level languages. JVM should be free of errors as a Java program depends on JVM. Any failure of JVM leads to the failure of the program.


Comments

Post a Comment