1、电 子 科 技 大 学UNIVERSITY OF ELECTRONIC SCIENCE AND TECHNOLOGY OF CHINA硕士学位论文MASTER THESIS论文题目 基 于 安 卓 应 用 的 虚 拟 化0 键 技 术 研 究 0 科 专 业 计 算 机 软 件 与 理 论 学 号 2 0 1 1 2 1 0 6 0 3 1 3作 者 姓 名 张 相 皓指 导 教 师 傅 彦 教 授分类号 密级UDC 注 10 位 论 文 基于安卓应用的虚拟化关键技术研究(题名和副题名)张相皓(作者姓名)指导教师 傅 彦 教授电子科技大学 成都(姓名、职称、单位名称)申请学位级别 硕士 学科专
2、业 计算机软件与理论提交论文日期 2014.3 论文答辩日期 2014.5学位授予单位和日期 电子科技大学 2014 年 6 月 29 日答辩委员会主席评阅 人注 1:注明国际十进分类法 UDC的类号。RESEARCH ON KEY TECHNOLOGIES OF VIRTUALIZATION ANDROID-BASED APPLICATIONSA Master Thesis Submitted toUniversity of Electronic Science and Technology of ChinaMajor: Computer Software and TheoryAuthor:
3、 Zhang XianghaoAdvisor: Professor Fu YanSchool: School of Computer Science & Engineering独创性声明本人声明所呈交的学位论文是本人在导师指导下进行的研究工 作及取得的研究成果。据我所知,除了文中特别加以标注和致谢的地 方外,论文中不包含其他人已经发表或撰写过的研究成果,也不包含 为获得电子科技大学或其它教育机构的学位或证书而使用过的材料。 与我一同工作的同志对本研究所做的任何贡献均已在论文中作了明 确的说明并表示谢意。作者签名: 日期: 年 月 日论文使用授权本学位论文作者完全了解电子科技大学有关保留、使用学
4、位论文 的规定,有权保留并向国家有关部门或机构送交论文的复印件和磁 盘 ,允许论 文被查阅和借阅。本人授权电子科技大学可以将学位论文 的全部或部分内容 编入有关数据库进行检索,可以采用影印、 缩印或 扫描等复制手段保存、汇编学位论文。(保密的学位论文在解密后应遵守此规定)作者签名: 导师签名:日期: 年 月 日摘要0 要 近几年来,随着云计算的大力发展,它已 经成为一种整合软、硬件 资源的重 要方式,通过 云计算来改善硬件 资源的部署和资源的管理模式。通过云计算服务, 用户可以通过互联网像用煤电般扩展自身的计算与存储能力。另外,随着智能手 机的越来越普及,用户对 智能手机的上网体 验、 图像软
5、件的处理速度等需求要求 越来越高, 进而对手机硬件配置提出更高的要求。在这种环境下,如果能将网络 通信和云计算服务进行结合,它不仅充分利用了移动 网络的带宽,而且 结合了 PC时代的云计算的云平台(PaaS)的服务模式,即是通过云计算平台供应商将业务 软件的开发环境、运行环境作为一种服务,通 过移动互联网提交给用户,在云端 运行用户手机终端的应用程序,提高应用程序的运行速度。本论文就是结合云计算和安卓系统,提出了一个基于 Android4.0 平台的安卓 应用的虚拟化框架,该框架包括静态分析模块、 动态分析模 块、虚 拟化指令添加 与内存获取模块、服务端克隆与手机端恢复模块以及服务端和移动端的
6、通信模型五个部分。首先是对应用程序 APK 文件进行静态分析,确定适合迁移函数的范围, 然后修改 Android4.0 系统,添加虚拟化指令, 获取 转移函数的上下文数据,接着 对函数进行动态分析,若满足转移条件(该函数适合虚拟化),就将该函数通过网 络转移到云端执行,并将函数执行的结果返回到移动端,以加速应用的执行效率。 依据安卓虚拟化框架设计,本文着重研究了如下模块:首先,虚拟化指令添加和内存获取模块, 该模块分为虚拟化指令添加和内存 获取两个子模块。针对虚拟化指令添加模块,本文首先是通过调试分析了 dex 文件(安卓应用的可执行文件)解析过程和 Android4.0 平台的指令集的设计与
7、实现 原理,然后在根据应用程序函数训练的结果对满足转移条件的函数添加自定义的 指令,以支持虚拟化。针对内存获取模块,本文通 过研究 Dalvik 虚拟机的垃圾回 收机制、Dalvik 虚拟机自身访问内存的方式, 设计并实现了一个获取函数上下文 数据的模块。其次,服务器端和移动端的通信模块, 该模块包括移动端和服务器端两部分。 针对该通信模块的研究内容,移动端主要是解决何时创建迁移线程、如何和被转 移线程通信以及出错处理;服务器端,除了解决移动端涉及的内容外,更重要的 是采用程序插桩技术解决了如何执行移动端被转移的函数。关键词:应用虚拟化,Dalvik 指令集,迁移 线程IABSTRACTABS
8、TRACTIn recent years, with the vigorous development of cloud computing, it has become an important way of integrating software and hardware resources through cloud computing to improve the deployment of hardware resources and management of resources. Through cloud computing services, user can expand
9、 their computing and storage capacity over the Internet , Like coal and electricity. The users demand in the smart phone Internet experience, the image software processing speed and other aspects increasingly demanding, Therefore putting forward higher requirements on mobile phone hardware configura
10、tion. In this environment, If we can combine network communication and cloud computing services, it not only makes full use of the mobile network bandwidth, but also combined with the PC era of cloud computing cloud platform (PaaS) service mode, that is, through the cloud computing platform vendors
11、will business software development environment and running environment as a service, through the mobile Internet is submitted to the user, running in the cloud users of mobile terminal applications, improving the running speed of the application.This thesis is a combination of cloud computing and An
12、droid systems, proposed a virtualization framework based on Android4.0 platform and Android applications, The framework has five components, namely, static analysis module, dynamic analysis module, add virtualization instruction and memory acquisition module, the server cloning and mobile client rec
13、overy module, server and mobile terminal communication model. First, the application APK file for static analysis to determine the appropriate scope of the migration function, and then modify Android4.0 system, add virtualization instruction, access to contextual data transfer function, followed by
14、a dynamic analysis of the function, if it satisfies the transition condition (the function suitable for virtualization), put the function is transferred through the network to the cloud and executed, and then sends the result of the function to run in the cloud to the mobile terminal, to accelerate
15、application execution efficiency. According to the virtualization framework design, this paper focuses on the following modules:Firstly, add virtualization instruction and memory acquisition module, the module is divided into two sub-modules, which is to add virtualization instructions and obtan the
16、 data related function memory. For adding virtualization instruction module, this paper firstly analyzed dex file (Android application executable file)IIABSTRACTparsing process by debugging and Android4.0 platform design and implementation of the principle of instruction set, For adding virtualizati
17、on instruction module, this paper firstly analyzed by debugging dex file (Android application executable file) parsing process and Android4.0 platform design and implementation of the principle of instruction set, and then according to the result of application function training, to meet the conditi
18、ons of virtualization (can be transferred to the cloud) function adds a custom command. For memory access module, based on the research of Dalvik virtual machine garbage collection mechanism and its own Dalvik virtual machine access memory way designs and realizes a context data of function acquisit
19、ion module.Secondly, the server and mobile communication module, the module consists of a mobile client and server side. For the research content of this communication module, mobile terminal is mainly to solve what moment create migration threads, how to communicate with transferred thread and error handling. The server side, in addition to solve involves the content of the mobile terminal, more importantly, program pile technology is used to solve the problem of how to execute the transfer function.Keywords: application virtualization, Dalvik instruction set, migration thread