`
fxxd1212
  • 浏览: 25644 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Android深入浅出系列课程---Lesson13 LLY110529_虚拟机概述,JIT概述

阅读更多
大家好,上一讲我们介绍了Android.Framework源码下载及编译,这一讲我们将进入虚拟机概述,JIT概述
        课程目标:
知道虚拟机的概念,JVM , JIT
        重点难点:       
虚拟机带来的好处
        考核目标:
C++ 和 Java编译上的区别   应用层代码不修改,为何有时候可以编译过,有时候编译不过 ?
        什么是虚拟机?
一种抽象,一种仿真
虚拟机(Virtual Machine)指通过软件模拟的具有完整硬件系统功能的、运行在一个完全隔离环境中的完整计算机系统。
An efficient, isolated duplicate of a real machine. –Popek and Goldberg 1974

System virtual machine:一个系统的仿真和抽象,可供一个或多个操作系统在上面运行。Eg: VM Ware, QEMU, KVM
虚拟机指令集可与硬件CPU指令不同
提供隔离isolation

Process virtual machine:只供一个进程的仿真执行 Eg:JVM(Java Virtual Machine), Microsoft .NET
提供可移植性(portability)
WORA, Write once, run anywhere. --Slogan of Sun Microsystem
虚拟的机器:4G内存,标准的IO


WORA: Write Once, Compile once, run everywhere
应用程序和Bytecode编译器独立于硬件(machine-independent)

虚拟机软件仿真要实现指令集转换,虚拟地址物理地址的转换,代价慢!Java刚问世时比C/C++ 慢20X+

        什么是JIT
改进:实时编译JIT(Just in Time) compiler
只有新的Bytecode指令需要编译
A typical program with loops and repeated function calls should execute 10x faster using JIT.
No free lunch:需要储存空间,占内存(memory footprint)

啥叫实时? 编译什么? When and What to compile?
Method invoke time? Instruction fetch time? Application launch time?
Whole program?  A page?  Method?  Single instruction?

A compiler's primary function is to compile, organize the compilation, and go right back to compiling. It compiles basically only those things that require to be compiled, ignoring things that should not be compiled. The main way a compiler compiles, is to compile the things to be compiled until the compilation is complete.
        汇编器,链接器,加载器
汇编器(Assembler): 转换标签(Tag)为偏移量(offset),汇编语言的IDE,
链接器(Linker):多个目标文件和库变为一个可执行文件或新的库

静态vs动态链接
编译过的常用库二进制码只存一处
更新方便,but … DLL Hell

加载器(Loader):加载到内存:execve().
本讲对虚拟机概述,JIT概述,下一讲将进入Handler-不可缺少的异步_
上,内容预告:AFF110529_Handler-不可缺少的异步_上,敬请期待。

特别推荐新课程:Android开发高端课程
http://www.mobidever.com/forum.php?mod=viewthread&tid=2098
本课视频地址:http://www.tudou.com/programs/view/eMFpniJRUJY/  (土豆网)
课程下载地址:http://www.verycd.com/topics/2900036/ (VeryCD电驴)
作者博客:http://www.mobidever.com/forum.php (Sundy-Android开发联盟)
  • 大小: 22.7 KB
  • 大小: 19.3 KB
  • 大小: 6.7 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics