Android system Panorama (Turn)

Source: Internet
Author: User

Turn from Gityuan's Android to further organize self-learning.

Android system to Linux内核 use as a base, upper layer Native层 and Java层 . The system is divided into kernel space and user space, and communicated through system call ( Syscall ). User space is mainly implemented in C + + and Java code, through which the JNI Java layer and the native layer are communicated through technology (C + +).


Image source Gityuanloader Layer
    • Boot ROM: The power is pressed, the boot chip code starts to execute from a predefined place (cured in ROM). Loads the bootloader to RAM , and then executes.
    • boot Loader: This is the Android system before the boot program, mainly used to detect external RAM and set the network, memory, initialization of hardware parameters.
Kernel layer

The kernel layer refers Android to the kernel layer, which is just beginning to enter the Android system.

    • Initiated Kernel swapper process (pid=0): This process is also known as a idle process, the system initialization process is initiated Kernel by the first process, to initialize the process management, memory management, loading Display,Camera Driver,Binder Driver and other related work (in the kernel figure Layer blue blocks);
    • Start Kthreadd process (pid=2): is Linux the kernel process of the system, it creates a kworkder ksoftirqd,thermal series of kernel daemons, such as kernel worker thread, soft thread break process, etc.kthreadd进程是所有内核进程的父进程。

LinuxKernel loading mainly includes initializing kernel core (memory initialization, opening interrupt, initializing process table, etc.), initializing driver, starting kernel background ( daemons ) thread, installing root ( root ) file system, etc. The first user-level process init (pid=1) is subsequently started.

Native Layer

Native层Mainly includes init进程 the start ( Android the first user space process), HAL层 (Hardware abstraction layer), and 开机动画 so on. init进程是所有用户进程的鼻祖. init进程It also hatches a series of user processes, as well as initiating critical services and hatching Zygote进程 .

    • init进程Will hatch out the ueventd、logd、healthd、installd、adbd、lmkd user daemon process;
    • init进程Also launch servicemanager(binder服务管家)、bootanim(开机动画) and other important services
    • init进程Hatched Zygote进程 , is the first of the Zygote进程 Android system Java进程 , Zygote是所有Java进程的父进程 and Zygote进程 itself is init进程 hatched from.
  • Kthreadd process: Is the parent process of all kernel processes
  • Init process: Is the parent process (or parent process) of all user processes
  • Zygote process: Is the parent process of all upper-level Java processes, and the zygote parent process is the INIT process.
Framework Layer

, Framework层 divided into Java Frameword and C++ Framework , respectively, by system_server进程 and media_server进程 responsible for initiating and managing.

Zygoteitself is an Native application that begins with the name “app_process” , which, during the run, changes its name by system call Zygote . The red line in the picture is the Zygote fork process that comes out, and all App进程 is produced by it Zygote fork .


Image.png
    • Zygote进程, which is generated by the INIT process after parsing the init.rc file, the zygote process mainly contains:
      Load Zygoteinit class, register zygote socket server socket;
      Load the virtual machine;
      preloadclasses;
      Preloadresouces.
    • System Server进程, which is the zygote process fork, System server is the first process that zygote hatch, System server is responsible for starting and managing the entire Java framework, including Activitymanager, PowerManager and other services.
    • Media Server进程, is the INIT process Fork, responsible for starting and managing the entire C + + framework, including Audioflinger,camera service, and other services.
App Layer
    • Zygote进程孵化出的第一个App进程是Launcher, this is the desktop app that the user sees;
    • The zygote process also creates app processes such as Browser,phone,email, with each app running at least one process.
    • All app processes are generated by the zygote process fork.
Syscall && JNI
    • There is a layer of system call (SysCall) between native and kernel, see the principle of Linux system call (SysCall);
    • The link between the Java layer and the native (c + +) layer is JNI, see the Android JNI principle analysis.

Andorid Start-up process
Android Process Grooming

Android system Panorama (Turn)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.