原标题:Android OS boot process
Zygoteis a special Android OS process that enables shared code across Dalvik/Art VM in contrast with Java VM where each instance has its own copy of core library class files and heap objects.
Efficient and fast app launch is achieved thanks to the fact that Zygote starts by preloading all classes and resources which an app may potentially need at runtime into the system’s memory. It then listens for connections on its socket for requests to start new apps. When it gets a request to start an app, it forks itself and launches the new app. It serves as a parent to all Android apps.
This forking feature comes from the Linux kernel implementation of copy-on-write resource management technique. Forking involves creating a new process that is an exact copy of the parent process. It doesn’t actually copy anything, instead it maps pages of the new process over to those of the parent process and makes copies only when the new process writes to a page. All processes started from Zygote use their own copy and only one copy of the system classes and the resources that are already loaded in the system memory.
Zygote is designed not only to respond to fork requests by new apps, but there is one process that Zygote actually starts explicitly and that is the System Server process.返回搜狐,查看更多
责任编辑: