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

JRE

 

 

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

 

posted @ 2016-06-26 16:09  morningdew  阅读(234)  评论(0编辑  收藏  举报