Java's Architecture
Java's Architecture
• Object-Oriented
• Robust
• Architecture Neutral and Platform Independent
• Multithreaded
• Dynamic
• Distributed
Java's Architecture
Java's architecture arises out of four distinct but
interrelated technologies:
•Java programming language
•Java class file format
•Java Application Programming Interface
•Java virtual machine
Relationship between these four parts
JVM and Java API form a "platform" for which all Java programs are
compiled.
The Java Virtual Machine
The Java virtual machine is an abstract computer
Java Runtime contains a class loader, which loads class files
from both the program and the Java API.
Only those class files from the Java API that are actually needed
by a running program are loaded into the virtual machine.
The bytecodes are executed in an execution engine.
On a Java virtual machine implemented in software, the simplest
kind of execution engine just interprets the bytecodes one at a
time.
The native machine code for the method is then cached, so it can
be re-used the next time that same method is invoked.
Java Virtual Machine Architecture
Each instance of the Java virtual machine has one method area
and one heap.
shared by
all threads
running
inside JVM
When the virtual machine loads a class file, It places this type
information into the method area.
As the program runs, the virtual machine places all objects the
program instantiates onto the heap
As each new thread comes into existence, it gets its own
pc register (program counter) and Java stack.
The sizes of the local variables and operand stack, which are
measured in words, depend upon the needs of each individual
method
Values of type int, float and reference occupy one entry in the
local variables array.
Values of type byte, short, and char are converted to int before
being stored into the local variables.
But unlike the local variables, which are accessed via array
indices, the operand stack is accessed by pushing and popping
values.