Zygote process creation
Zygote Process Creation Deep Dive¶
Overview¶
Zygote is a special Android process that preloads framework/runtime state and forks app processes quickly, reducing cold start overhead.
Why Zygote Exists¶
- Starting a fresh VM per app is expensive.
- Preloading classes/resources once and forking is faster.
- Copy-on-write allows shared memory pages until modified.
Process Creation Flow¶
- System boots and starts Zygote.
- Zygote preloads framework classes/resources.
- ActivityManager requests new app process.
- Zygote
fork()creates child process. - Child process initializes app runtime and
Application.
Performance Impact¶
- Faster app startup, especially cold start.
- Better memory sharing across app processes.
Interview Traps¶
- Zygote does not run your app code directly; child process does.
- Forked process still performs app-specific initialization.
- Process creation speed depends on more than Zygote (I/O, app init work).
Key Takeaways¶
- Zygote is central to Android startup architecture.
- Fork + copy-on-write is core optimization.
- Keep app initialization lean to benefit fully.