Zhang Xiang
Zhang Xiang

Reputation: 442

What's the relationship between Dalvik and Zygote process?

I just want to know :

Upvotes: 6

Views: 2896

Answers (4)

user19954627
user19954627

Reputation: 11

Zygote is one of the first init processes created after the device boots. It initializes the Dalvik virtual machine and tries to create multiple instances to support each Android process. As discussed in earlier sections, the Dalvik virtual machine is the virtual machine that executes Android applications written in Java.

Zygote facilitates using a shared code across the VM, hence, helping to save the memory and reduce the burden on the system. After this, applications can run by requesting new Dalvik virtual machines. Zygote registers a server socket for zygote connections and preloads certain classes and resources. This zygote loading process has been more clearly explained at https://elinux.org/Android_Zygote_Startup ...

Upvotes: 1

Ratnesh
Ratnesh

Reputation: 318

Zygote actually the child of init process which occur as boot process start. It is responsible of loading Dalvik virtyal machine by which our Dalvik Bytecode get executed. Also, it preload all the necessary resource all shared java classes and resources into memory.

Upvotes: 0

Languoguang
Languoguang

Reputation: 2224

Add some example to explain that Zygote is the parent of all App process. zygote PID : 481, my application processes PPID : 481, you can use ps command to check.

UID            PID  PPID C STIME TTY          TIME CMD
root           481     1 0 09:17:54 ?     00:00:03 zygote
u0_a132      28993   481 78 09:07:53 ?    00:23:46 com.languouang.helloworld
u0_a132      29013   481 0 09:07:53 ?     00:00:01 com.languouang.helloworld:countservice
u0_a132      29296   481 1 09:09:04 ?     00:00:09 com.languouang.helloworld:mall
u0_a132      30427   481 1 09:16:42 ?     00:00:15 com.languouang.helloworld:faq

Upvotes: 3

CodeWalker
CodeWalker

Reputation: 2388

Dalvik VM was authored by Dan Bornstein
Every android application runs in a separate process, has its own Dalvik VM.

Zygote is a daemon with the only mission to launch applications. This means that Zygote is the parent of all App process. When app_process launches Zygote, it creates the first Dalvik VM and calls Zygote’s main () method. Once Zygote starts, it preloads all necessary Java classes and resources, starts System Server and opens a socket /dev/socket/zygote to listen for requests for starting applications.

Upvotes: 11

Related Questions