Skip to content

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

  1. System boots and starts Zygote.
  2. Zygote preloads framework classes/resources.
  3. ActivityManager requests new app process.
  4. Zygote fork() creates child process.
  5. 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.