Inside the Android Virtual Machine

钟世礼Posts & Telecom Press2016

No rating yet
Chapters
25
ISBN
9787115423535

Tags

Computing Programming Memory ModelMemory ManagementKernel Source CodeLife CycleMobile DevelopmentProgrammed LifeSystem Source CodeInter-Process CommunicationSource Code AnalysisKey Points

Summary

There are many books on the Android application layer, but few that truly descend to the virtual machine layer. The value of this book lies in its treatment of the Dalvik VM and ART as a single main line, running from obtaining and building the source code all the way to DEX parsing, the memory system, garbage collection, JIT, and ART startup, covering almost all the major knowledge points of the Android virtual machine with a complete route and a natural logical flow from beginning to end. The author writes in a progressive manner, concepts first and source code after, and for each mechanism tries to give the process and operating flow rather than listing code fragments in isolation, which makes it reasonably friendly even to readers who have not systematically studied virtual machines. Chapter 24 is devoted to comparing the differences in installing APKs under Dalvik and ART, which is precisely the key to understanding the evolution of the two generations of runtime, and such details are rare in comparable books. One caveat: the book was written around 2016, and its source code versions are mainly those of Android at the time; the Android runtime has since gone through several rounds of evolution, so readers should treat it as a primer for understanding the classic Dalvik/ART mechanisms and read it alongside newer AOSP source code.

Editor's review

市面上讲Android应用层的书很多,真正下沉到虚拟机这一层的却少。本书的价值在于它把Dalvik VM和ART当作一条主线,从源码获取与编译一路走到DEX解析、内存系统、垃圾收集、JIT与ART启动,几乎覆盖了Android虚拟机的主要知识点,路线完整,前后逻辑衔接自然。作者采用由浅入深的写法,概念先行、源码随后,每讲一个机制都尽量给出进程与运作流程,而不是孤立罗列代码片段,对没有系统学过虚拟机的读者也算友好。第24章专门对比在Dalvik与ART环境下安装APK的差异,恰是理解两代运行时演进的关键,这类细节在同类书中并不多见。需要提醒的是,本书写作于2016年前后,源码版本以当时的Android为主,之后Android运行时又历经多轮演进,读者宜把它当作理解Dalvik/ART经典机制的底本,配合较新的AOSP源码对照阅读。

Who it's for

A good fit for

Not a good fit for

Reading tips

  1. 先读第2、3章打好JVM与Dalvik/ART的差异认知,再进入源码级章节,避免一上来被细节淹没。
  2. 第1章的源码编译环节动手做一遍,后续章节的调用链才有可对照的实际代码。
  3. 按“进程与启动—DEX与内存—垃圾收集与优化—ART”四条线程做笔记,把分散章节串成一张运行时地图。
  4. 结合较新AOSP源码对照阅读,留意书中结论在后续版本中的变化,并配合自行编写小实验验证。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Preface
  2. Chapter 1 Obtaining and Building Android Source Code
  3. Chapter 2 Java Virtual Machine Fundamentals
  4. Chapter 3 Dalvik and ART Fundamentals
  5. Chapter 4 Analyzing JNI
  6. Chapter 5 Analyzing the Memory System
  7. Chapter 6 Android Program Lifecycle Management
  8. Chapter 7 IPC Process Communication Mechanism
  9. Chapter 8 The init Process in Detail
  10. Chapter 9 The Dalvik VM Process System
  11. Chapter 10 The Dalvik VM Operating Flow in Detail
  12. Chapter 11 The DEX File in Detail
  13. Chapter 12 The Dalvik VM Memory System in Detail
  14. Chapter 13 The Dalvik VM Garbage Collection Mechanism
  15. Chapter 14 The Dalvik VM Memory Optimization Mechanism in Detail
  16. Chapter 15 Analyzing the Dalvik VM Startup Process
  17. Chapter 16 Registering the Dalvik VM and Creating Threads
  18. Chapter 17 Dalvik VM Exception Handling in Detail
  19. Chapter 18 JIT Compilation
  20. Chapter 19 Dalvik VM Memory Optimization
  21. Chapter 20 Dalvik VM Performance Optimization
  22. Chapter 21 Analyzing the ART Startup Process
  23. Chapter 22 Executing the ART Main Program
  24. Chapter 23 Installing APK Applications
  25. Chapter 24 Installing APK Applications in the ART Environment

FAQ

这本书讲的是Dalvik还是ART? 两者都讲。全书以Dalvik VM为主线,用约二十章分析其进程系统、运作流程、DEX文件、内存系统、垃圾收集、启动过程、异常处理与JIT等,最后四章转向ART的启动、主程序执行及两种环境下安装APK的差异。
书中的源码分析会在哪个Android版本上更准确? 本书2016年出版,内容基于成书时期的Android源码,并提到Windows获取Android L源码。越接近该书写作年份的AOSP版本越容易对上,之后的版本中运行时已有较多演进,需要自行辨别差异。
零基础能读懂这本书吗? 不太适合完全零基础者。书中涉及JNI、C/C++与大量系统源码调用链,建议先具备Java基础、了解Linux与基本的操作系统概念,再读第2章Java虚拟机基础,然后进入后续章节。
这本书页数和价格大概是多少? 据图书馆书目与书店信息,全书595页、16开,2016年出版时的定价为99元。具体售价会随渠道与新旧程度变化,购买前建议核实。

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

About the author

钟世礼 Author

Zhong Shili is an author for whom publicly available information is currently limited, and no systematic disclosure of background details has been found. According to the library's holdings, Zhong Shili has one work, In-Depth Analysis of the Android Virtual Machine, classified under programming and design. The book provides an in-depth examination of the Android virtual machine and is a technical title aimed at developers, focusing on the underlying mechanisms of a mobile operating system and the principles of program execution. Works of this kind typically combine analysis of principles with implementation details and serve technical readers who wish to understand the Android runtime environment. Because little biographical information is available, it is not possible to add details about the author's education, professional experience, or other publications. Readers may regard Zhong Shili as an author who writes on specialized topics in Android technology and may use this book to learn about the relevant underlying knowledge.