Uncategorized

Core Java Questions

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
Global Variables Registers
Open files Stack
Child Processes State
Pending alarms
Signals and signal handlers
Accounting Information

– 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

One comment

  1. Kairii

    Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch since I found it for him smile Thus let me rephrase that: Thank you for lunch! “The capacity to care is what gives life its most deepest siineficancg.” by Pablo Casals. July 16, 2012

Leave a Reply

Your email address will not be published. Required fields are marked *