Академический Документы
Профессиональный Документы
Культура Документы
Javaisaprogramminglanguageoriginallydeveloped
byJamesGoslingatSunMicrosystems.
ThelanguagederivesmuchofitssyntaxfromCandC+
+buthasasimplerobjectmodel.
Javaapplicationsaretypicallycompiledtobytecode
(classfile)thatcanrunonanyJavaVirtual
Machine(JVM)regardlessofcomputerarchitecture.
Virtualmachine
BeforeunderstandingwhatisJVMletusfirst
knowwhatvirtualmachineis.
Avirtualmachineisalayerofabstractionthat
givesaprogramonesimplifiedinterfacefor
interactingwithavarietyofphysicalcomputers
andtheiroperatingsystems.
JVMsareavailableformanyhardwareand
softwareplatforms.
TheuseofthesamebytecodeforallJVMsonall
platformsallowsJavatobedescribedasa"write once,
run anywhere"programminglanguage.
Thus,theJVMisacrucialcomponentoftheJava
platform.
DiagramofJVM
ComponentsofJVM
1.
2.
3.
4.
5.
Bytecodeverifier
Classloader
Executionengine
Garbagecollector
SecurityManager
Bytecodeverifier
Asthenamesuggests,bytecodeverifierisusedtoverify
thebytecode.
Bytecodeverifierchecksforunusualcode.
Classloader
Classloaderloadsjavaclassesintojavavirtualmachine.
AllJavavirtualmachinesincludeoneclassloaderthatis
embeddedinthevirtualmachine.
ThemainfeatureoftheclassloaderisthatJVM.
doesntneedtohaveanyknowledgeabouttheclasses
thatwillbeloadedatruntime.
Classloaderreadsbytecodeandcreatestheinstanceof
theclass
Executionengine
TheexecutionenginehelpsJVMtoconvertbytecodeinto
machinecode.
Ithastwoparts:
a)Interpreter
b)Just-in-time-interpreter
Note:aninterpretergeneratesandexecutesthemachinecode
instructionsontheflyforeachinstructionregardlessof
whetherithaspreviouslybeenexecuted.
whereas
AJITcachestheinstructionsthathavebeenpreviously
beeninterpretedtomachinecode,andreuses
thosenativemachinecodeinstructionthussavingtime
&resourcesbynothavingtore-interpretstatements
thathavealreadybeeninterpreted.
Executionengineisresponsibleforexecutingthe
instructionscontainedinthemethodsofloaded
classes.
Garbagecollector
Garbagecollectionistheprocessofautomaticallyfreeing
objectsthatarenolongerreferencedbytheprogram.
Itperiodicallycheckfortheobjectonheap,whoselinkis
brokensoitcancollectgarbagefromheap.
Garbagecollectionrelievesjavaprogrammer
frommemorymanagement.
Securitymanager
Securitymanageconstantlymonitorsthecode.
Itisspecial javaobjectthatisresponsibleforguarding
securitypoliciesforjavaapplications.
Itisalwaysconsultedbeforeanypotentiallydangerous
operationisrequestedbyajavaapplication.
ComparisonofJVM
Othersoftware:
JVM: