Zygote
Learning path · You want the source

The Platform Nerd

The whole machine, bottom to top. Kernel, boot, Binder, the runtime, system_server, the vendor boundary — then ten quests through the real source.

pages
18
estimated
229 min
0%

0 of 18 pages read

229 minutes in total.

Start with “Android's kernel, and its androidisms” →
  1. Android's kernel, and its androidisms

    Android runs on Linux, but not quite the Linux you would install on a server. This page is about the four jobs the kernel does for Android, the handful of features Android bolted on, and what happened to each of them.

    15 minintermediatekernel
  2. Branches, GKI and the KMI

    For years every phone shipped a different kernel, and a security fix could take years to arrive. GKI made the kernel a single signed binary and moved board support into loadable modules behind a frozen interface.

    15 minnerdkernel
  3. The boot sequence

    From a press of the power button to the first frame of the home screen: eight stages, four signed handoffs, and a device that has to prove what it is running before it is allowed to run it.

    14 minintermediateboot
  4. init and init.rc

    One small C++ program is PID 1, mounts the world, loads the security policy, starts every daemon and restarts them when they die. Its configuration language is the closest thing Android has to an init system.

    14 minnerdboot
  5. Why Binder won

    Android had sockets, pipes and shared memory. It built a kernel driver instead — because IPC on a phone has to be fast, attributable, and bounded, and no general-purpose transport is all three.

    14 minintermediateipc
  6. Binder, the driver

    One ioctl, a Parcel, a handle table and a reference count. The Binder driver is a small kernel component that decides how a hundred million calls a day behave when things go wrong.

    12 minnerdipc
  7. AIDL: the interface language

    Write the contract once, and the build generates the Parcel marshalling for both sides. AIDL is the difference between 'call transact()' and 'call getTaskCount()'.

    11 minintermediateipc
  8. Zygote: the mother of processes

    Every app and system_server is a fork of one warm process. Zygote is why an app can start in a few hundred milliseconds despite having no main() of its own.

    12 minbeginnerruntime
  9. ART: ahead-of-time, then hybrid

    ART began as the runtime that compiled everything at install. It is now a hybrid of interpreter, JIT and profile-guided AOT, shipped as an updatable module — and each swing of that pendulum was a reaction to the previous one's cost.

    12 minnerdruntime
  10. Garbage collection and jank

    A GC pause of 20 ms is a dropped frame. ART's collector history is a fifteen-year attempt to make that number independent of how much memory the app is using.

    11 minnerdruntime
  11. What system_server is

    One Java process hosts most of the framework's services, is forked from Zygote at boot, and takes the whole UI down with it when it dies. This is what lives inside it and why it is shaped that way.

    13 minintermediatesystem-server
  12. Activity and task management

    Two services divide the work of running apps: ActivityTaskManager owns activities and the back stack, and ActivityManager owns processes and everything else. The split explains most of what a launch actually costs.

    12 minintermediatesystem-server
  13. Project Treble

    Android 8.0 drew a line through the platform. On one side the system image, on the other the vendor image, and between them a versioned, declared, testable interface that neither side could silently break.

    12 minnerdhal-treble
  14. Mainline and APEX

    Treble made the vendor side replaceable. Mainline made the platform side replaceable too. The container is the APEX, and the delivery channel is the Play Store.

    14 minnerdhal-treble
  15. SELinux

    Linux has discretionary access control: if you own a file, you decide who else may read it. SELinux adds mandatory access control: a policy written by someone else decides, and even root is subject to it.

    11 minnerdsecurity
  16. The life of a frame

    From a touch to photons: how one frame moves through the UI thread, the RenderThread, the GPU, BufferQueue, SurfaceFlinger and the display — and why 16.67 ms is the number that governs everything.

    13 minintermediategraphics
  17. How to read AOSP

    AOSP is tens of millions of lines across thousands of repositories. Reading it is a skill with a method: find the entry point, follow the Binder boundary, read the build file, and ignore the generated code. This page teaches the method.

    13 minintermediateaosp-tour
  18. Ten reading quests

    Ten source-reading quests, each with a question and a place to look: the zygote fork, the init language, a system service's birth, the framework facade, an IPC call, package install, the frame loop, permissions, intent resolution, and a Mainline boundary.

    11 minnerdaosp-tour