As you know in any machine, we have different components like a hardware (physical machine call it as hardware(CPU, RAM.. etc) and software (Operating System). if you want to perform any operation from another machine, we need to write some code (say in c language) which will open a socket connection, that is a remote network call to other machine and make an OS call i.e native call. Each machine should have different ways to handle this situation. Here the code is tightly coupled means dependent on the target machine. if the target machine is changed or a new machine. The existing code would not work in this case. so that means platform dependent. After the Java virtual machine is introduced, many problems are solved. write once deploy to any machine.
as the name suggests it is a virtual machine run as java process which talks to a physical machine. JVM is dependent on the physical machine, but it gives independent to different machines in the form of Java code. It is a virtual platform on top of your physical processor.JVM is one of a component of Java runtime environment.
JRE contains a set of Java-based API as well as JVM. The following are responsibilities of the JVM
JVM has different components.
Heap memory is one of the components of the JVM machine which stores the object. here object means which holds the member variables, constructors, and methods. By default heap size is 64 MB. we can increase the size using -Xmx(maximum heap size) and -Xms(initial heap size) options. a lifetime of an object as long as it is referenced. whenever an object is unreferenced, Garbage collector using some algorithm will destroy the objects
holds the local variables. The lifetime of the local variables is the temporary as long as a method executed. Once the function/method execution is over, these variable are removed. This follows the Last In First Out model.
This section holds the current bytecode that is executed presently. once the bytecode is executed, it will point to next bytecode.
which are used by the stack variable?
There are multiple different JRE by different vendors
Rick - Jan 3, 2012
Thanks for writing. Please keep it up, this is an interesting topic.
Thank you very much for your comment.