Add Zygote.startChildZygote() to fork a new process that itself is a zygote.
This adds a new --start-child-zygote argument that instructs the main zygote to create a new child process that will also be a zygote. The system_server generates a random name in the abstract socket namespace for it and the child-zygote to communicate over, and that is passed as an argument to the new process. A child-zygote bypasses the normal post-fork-child of the zygote process in order to preserve itself as a zygote. This means not starting the Binder threadpool nor launching into ActivityThread. Instead, a child-zygote calls into its own main function. The main function runs a ZygoteServer select loop, listening on the socket name specified by the system_server when it was forked. Unlike the system zygotes, a child-zygote can be killed without bringing down the system. Killing a child-zygote will not terminate its child processes, which will be reparented to init for reaping when they eventually exit. Bug: 63749735 Test: m (with multi-project commits landed) Change-Id: I3e7ebbdba498f8fec1d84cdf927dc43a92be4b68
Loading
Please register or sign in to comment