java 虚拟机运行时数据区域 Runtime Data Areas
The Java virtual machine defines various runtime data areas that are used during execution of a program. Some of these data areas are created on Java virtual machine start-up and are destroyed only when the Java virtual machine exits. Other data areas are per thread. Per-thread data areas are created when a thread is created and destroyed when the thread exits.
虚拟机定义了各种运行时数据区以备程序运行时利用。一部份在虚拟机启动时被创建,在虚拟机退出时被销毁。另一部份跟线程有关,在线程创建时被创建,线程退出时被销毁。
3.5.1 The pc Register 寄存器
The Java virtual machine can support many threads of execution at once (§2.19). Each Java virtual machine thread has its own pc (program counter) register. At any point, each Java virtual machine thread is executing the code of a single method, the current method (§3.6) for that thread. If that method is not native, the pc register contains the address of the Java virtual machine instruction currently being executed. If the method currently being executed by the thread is native, the value of the Java virtual machine's pc register is undefined. The Java virtual machine's pc register is wide enough to hold a returnAddress or a native pointer on the specific platform.
虚拟机支持多线程,每一个线程都拥有自己的寄存器。在任一点,每个虚拟机线程都执行特定代码,当前方法。如果此方法不适本地的,
3.5.2 Java Virtual Machine Stacks 虚拟机栈
Each Java virtual machine thread has a private Java virtual machine stack, created at the same time as the thread.3 A Java virtual machine stack stores frames (§3.6). A Java virtual machine stack is analogous to the stack of a conventional language such as C: it holds local variables and partial results, and plays a part in method invocation and return. Because the Java virtual machine stack is never manipulated directly except to push and pop frames, frames may be heap allocated. The memory for a Java virtual machine stack does not need to be contiguous.
The Java virtual machine
相关文档:
1)垃圾回收的两个关键要素:
发现无用对象。
回收无用对象的内存空间。
2)6种垃圾回收算法:
引用计数法,tracing 算法,compacting算法,copying 算法,generation算法,adaptive算法。
3)detail:
引用计数法(Reference Counting Collector)
引用计数法是唯一没有使用根集的垃圾回收的 ......
两种形式:
1, 饿汉式单例类
public class Singleton {
private Singleton(){}
//在自己内部定义自己一个实例,是不是很奇怪?
//注意这是private 只供内部调用
private static Singleton instance = new Singleton();
//这里提供了一个供外部访问本class的静态方法,可以直接访问
p ......
8.9.2 接口
接口(Interface)是一种复合数据类型。
至此,Java语言的所有数据类型介绍完了,下面进行一个简单的总结。Java语言的数据类型分为两大类:基本数据类型和复合数据类型,其中基本数据类型有8种,复合数据类 ......
一个Java接口(Interface)是一些方法特征的集合,这些方法特征当然来自于具体的方法,但是它们一般都来自于系统中不断出现的方法。一个接口只有方法的特征,而没有方法的实现,因此这些方法在不同的地方被实现时,可以有完全不同的行为。在Java语言的,Java接口还可以定义Public常量。 ......