A java virtual machine (JVM) is, by its name, a virtual machine that is built on top of the underlying hardware and operating system. It is just another process from the perspective of the operating system. It is loaded and executed by the operating system.
From the perspective of a java program, the JVM is (almost) every thing they have. Once it is loaded by the operating system, the JVM loads the java program, execute the main method just like the operating system loads and executes an executable.
An abstract computing machine, or virtual machine, JVM is a platform-independent execution environment that converts Java bytecode into machine language and executes it. Most programming languages compile source code directly into machine code that is designed to run on a specific microprocessor architecture or operating system, such as Windows or UNIX. A JVM -- a machine within a machine -- mimics a real Java processor, enabling Java bytecode to be executed as actions or operating system calls on any processor regardless of the operating system. For example, establishing a socket connection from a workstation to a remote machine involves an operating system call. Since different operating systems handle sockets in different ways, the JVM translates the programming code so that the two machines that may be on different platforms are able to connect.
WAIT A MINUTE! DIDN’T YOU SAY JVM IS PLATFORM DEPENDENT!

Hmm… yeah! I did. JVM is platform dependent in that the JVM used is not common across platforms. If you need your code to run on UNIX, you need a JVM for UNIX. But the way in which JVM executes the code is platform independent. Confusing huh? :) Let’s take up an example.
Mrs. Samuels had two sons Tom and Harry. Since the family was in poverty, she told her sons that they need to bring $100 each within a week to sustain their living. Tom being a hard working guy took up a lot of part time jobs and earned $100. Harry being a lazy guy with a good deal of friends told his situation to his friends and got the money from them. By the end of the week, the instruction given by Mrs. Samuels and the end results were consistent. However the way Tom and Harry IMPLEMENTED them is totally different. In the same way the instruction set for a JVM is constant across platforms. But for getting things actually done, platform specific features are used and hence we need separate JVM for separate platforms.
There are two components of JRE - Jasper and Jasmin which might be worth mentioning while we are on the topic.
Jasper is a program to read Java class files in binary byte code format. The program is capable of generating ASCII files which can be used in conjunction with the Jasmin Assembler. Jasper is also intended to generate input into a class file browser that can produce the inheritance hierarchy and composition maps from the java class files.
Jasmin is an assembler for the Java Virtual Machine. It takes ASCII descriptions of Java classes, written in a simple assembler-like syntax using the Java Virtual Machine instruction set. It converts them into binary Java class files, suitable for loading by a Java runtime system.
Even if you don't understand much from this post, never mind. This is just an additional information that you might be interested in knowing.
Feel it's high time for a break? Checkout http://forwardszone.blogspot.com
No comments:
Post a Comment