What is JVM?
Java Virtual Machine is an abstract machine which enable to run a Java program. Like a real computing machine, it has an instruction set and manipulates various memory areas at run time. The Java Virtual Machine knows nothing of the Java programming language, only of a particular binary format, the class file format.
What is a .class file?
A .class file contains Java Virtual Machine instructions or byte codes and a symbol table, as well as other additional information.
What is the different in Thread and Process?
– A program in execution is often referred as process. A thread is a subset of a process.
– A process consists of multiple threads. A thread is the smallest part of the process that can execute concurrently with other parts(threads) of the process.
– A process is sometime referred as task. A thread is often referred as lightweight process.
– A process has its own address space. A thread uses the process’s address space and share it with the other threads of that process.
|Per Process Items||Per thread items|
|Address space||Program Counter|
|Signals and signal handlers|
– A thread can communicate with other thread (of the same process) directly by using methods like wait(), notify(), notifyAll(). A process can communicate with other process by using inter-process communication.
How a class is loaded and executed in JVM Architecture?
There are different Classloaders available which loads .class files (internal and external) as soon as JVM is being started.
Loaded classes are fed into the Execution engine in the form of byte code instrcutions. Execution engine is responsible for executing the byte code. In order to execute the byte code, Execution engine communicates with Operating System as machine language and ultimately operations get executed. Execution engine also invokes native method.
What are the main components of JVM architecture?
At core, there are 3 main components of JVM architecture:
1. Class Loader Subsystem
2. Runtime data areas
3. Execution Engine