Tom Taylor
Tom Taylor

Reputation: 3560

What information are cloned when an application is created from Zygote process?

I'm aware of the concept that android clones a new process from Zygote during each application start - what information are cloned from zygote. It's unclear for me what information (whether information related to few system components are cloned).

  1. Why does it really clones from Zygote process?

  2. What information are cloned from Zygote process?

  3. Why does Zygote needs to be a parent process for each application process?

Though it's android's decision to do it in this way - would like to know whether there is any explicit technical reasoning which people are aware of for better understanding.

Upvotes: 0

Views: 461

Answers (1)

Erlkoenig
Erlkoenig

Reputation: 2754

The Zygote process preloads all the android frameworks into memory. This way, when forking a new (app) process from zygote, it has the frameworks already loaded, which speeds up application start-up. Linux' copy-on-write mechanism for memory pages even avoids duplication of the framework code in memory. Zygote also sets up various security context settings after forking to ensure all processes have the appropriate context (esp. SELinux).

Upvotes: 1

Related Questions