Java overview JVM
參考:?
http://www.cnblogs.com/java-chl/p/5614940.html
http://www.studytonight.com/java/component-of-java.php
?
JVM 生命周期
程序開始執行它才運行,程序結束時它就停止。一臺機器上運行幾個程序就有幾個JVM, JVM的生成開始于一個main() 方法. main() 方法是程序的起點
它被執行的線程初始化為程序的初始線程.程序中其他的線程都是有它來啟動.
JAVA中的線程分為兩種:守護線程(daemon) 和 普通線程(non-daemon). 守護線程是JVM自己使用的線程,比如負責垃圾收集的線程就是一個守護線程。
包含 main() 方法的線程是普通線程,只要JVM中還有普通的線程在執行,JVM就不會停止。
?
?
?
?
?
classLoader: loads the class for execution:
method area: stores pre-class structure as constant pool.
heap: in which objects are allocated
stack: local variables and partial results are stores here. ?Each thread has a private JVM stack created when the thread is created.
program register: program register holds the address of JVM instruction currently being executed
native method stack: it contains all native used in application.
execution engine: controls the execute of instructions contained in the methods of the classes
native method interface: gives an interface between java code and native code during execution
native method libraries: consist of files required for the execution of native code
?
method area 和 heap是整個程序共享的,JVM加載并解析一個類以后,將從文件中解析出來的信息保存在 method area中,程序創建的object
都保存在heap 中
?
當一個線程被創建時,會被分配屬于他自己的 pc register 和 stack,當線程不調用本地方法時,pc register中保存線程執行的下一條指令
stack保存了一個線程調用方法時的狀態,包括本地變量,調用方法的參數,返回值,處理的中間變量,調用本地方法時的狀態保存在 native method stack
?
?
?
Difference between JDK and JRE
JRE: The Java Runtime Environment provides the libraires, the JVM, and other components to run applets and applications written in JAVA. JRE does not contain tools and utilities such as compliers or debuggers for developing applets and applications
?
?
JDK: The JDK development kit is a super set of the JRE, and contains everything that is in the JRE, plus tools as te compilers and?
debuggers necessary for developing applets and applications
?
轉載于:https://www.cnblogs.com/morningdew/p/5617679.html
總結
以上是生活随笔為你收集整理的Java overview JVM的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: windows 7(32/64位)GHO
- 下一篇: JavaScript 流程控制语句