What is JDK
Describe the key steps in which a Java class is loaded by the JVM?
What are runtime data areas?
How is a java program executed by JVM?
Explain how Java programs are executed by the JVM?
What is the Java bytecodes?
What is the difference between JVM, JRE and JDK?
How is Java programming language machine and platform independent?
The runtime data areas?
Runtime data areas are memory areas assigned when the JVM runs on the OS. Runtime data areas are of two kinds - Those that are created for each thread and those that are shared by all threads
Memory areas created for each thread - There are three data areas that are created for each thread - PC Register, JVM Stack and Native method stack.
PC Register: PC (Program Counter) register has the address of a JVM instruction that is currently being executed. Each JVM thread has PC register which is created when the thread starts.
JVM Stack: A JVM stack is created for each JVM thread, and stores the strut or the stack frame. A stack frame is created when a method is executed, added to the JVM stack, and removed from the JVM stack when the method ends.
Native Method Stack : Native method stack is a stack for native data written in a language other than Java, and invoked through JNI. Each JVM thread has its own native method stack.
Memory areas shared by all threads : There are three runtime data areas that are shared by all threads. Heap, Method area and Runtime Constant Pool.
Heap : Heap is the memory area in which java object instances are stored, and removed by Java garbage collector. This is one of the memory areas that is commonly tuned for to improve JVM performance.
Method area : The method area stores runtime constant pool, field and method information, static variables and method bytecodes for all classes and interfaces that are loaded in the JVM.
Runtime constant pool : Runtime constant pool contains the constant for each class and interface, and all references for methods and fields. When a method or field is referenced, the JVM gets the actual address of the method or field from the Runtime constant pool.