1-android internals 10305904_nimit

Upload: anonymous-igvrm2ma6k

Post on 02-Jun-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 1-Android Internals 10305904_nimit

    1/36

  • 8/10/2019 1-Android Internals 10305904_nimit

    2/36

    Android Kernel Runtime Walkthrough

    Zygote

    Binder (IPC) Driver

    Layer Interaction JNI

    Contents

  • 8/10/2019 1-Android Internals 10305904_nimit

    3/36

    Why Linux Kernel ? Good memory and processmanagement

    Permission-based security model

    Proven driver model

    Support for shared libraries

    Provide core system services

    Android Kernel

  • 8/10/2019 1-Android Internals 10305904_nimit

    4/36

    Enhancements to Linux Kernel Binder (IPC) Driver

    Ashmem ( Android shared memorydriver )

    Alarm Driver and Logger

    Power Management

    Low Memory Killer

  • 8/10/2019 1-Android Internals 10305904_nimit

    5/36

    Android Kernel Runtime Walkthrough

    Zygote

    Binder (IPC) Driver

    Layer Interaction JNI

    Contents

  • 8/10/2019 1-Android Internals 10305904_nimit

    6/36

    Similar to Linux based system Boot-loader loads the Linux kernel

    Runtime Walkthrough

  • 8/10/2019 1-Android Internals 10305904_nimit

    7/36

    Kernel Initializes environment

    Mounts root file system

    Starts the Init process

    Runtime Walkthrough

  • 8/10/2019 1-Android Internals 10305904_nimit

    8/36

    Init starts daemons

    Runtime Walkthrough

  • 8/10/2019 1-Android Internals 10305904_nimit

    9/36

    Init starts the zygote process Initializes a Dalvik VM instance

    Links all core libraries and share it

    Use copy-on-write

    Runtime Walkthrough

  • 8/10/2019 1-Android Internals 10305904_nimit

    10/36

    Init starts runtime process Initializes Service Manager

    Context manager for Binder

    Runtime Walkthrough

  • 8/10/2019 1-Android Internals 10305904_nimit

    11/36

  • 8/10/2019 1-Android Internals 10305904_nimit

    12/36

    Start native services Surface and Audio Flinger

    Runtime Walkthrough

    Image is taken from : https://sites.google.com/site/io/anatomy--physiology-of-an-android

  • 8/10/2019 1-Android Internals 10305904_nimit

    13/36

    Runtime Walkthrough

    Image is taken from : https://sites.google.com/site/io/anatomy--physiology-of-an-android

  • 8/10/2019 1-Android Internals 10305904_nimit

    14/36

  • 8/10/2019 1-Android Internals 10305904_nimit

    15/36

    Image is taken from : https://sites.google.com/site/io/anatomy--physiology-of-an-android

  • 8/10/2019 1-Android Internals 10305904_nimit

    16/36

    Android Kernel Runtime Walkthrough

    Zygote

    Binder (IPC) Driver

    Layer Interaction JNI

    Contents

  • 8/10/2019 1-Android Internals 10305904_nimit

    17/36

    What is IPC? Exchanges data with anotherprocess

    Why IPC? Owns address space

    Provides data isolation

    Avoids direct interaction

    Inter-Process

    Communication IPC)

  • 8/10/2019 1-Android Internals 10305904_nimit

    18/36

    Linux Signal

    Pipe

    Socket Semaphore

    Message Queue

    Shared Memory

    IPC Mechanisms

  • 8/10/2019 1-Android Internals 10305904_nimit

    19/36

    Android Binder : Lightweight RPC (RemoteProcedure Call) mechanism

    IPC Mechanisms

  • 8/10/2019 1-Android Internals 10305904_nimit

    20/36

    Problems with old IPCMechanisms

    Separate processes

    Security holes

    IPC Mechanisms

  • 8/10/2019 1-Android Internals 10305904_nimit

    21/36

    SolutionDriver

    Shared memory

    Per-process thread pool

    Synchronous

    IPC Mechanisms

  • 8/10/2019 1-Android Internals 10305904_nimit

    22/36

    Binder with Service Manager

  • 8/10/2019 1-Android Internals 10305904_nimit

    23/36

    Binder in Transaction

    Image is taken from : http://www.slideshare.net/jserv/android-ipc-mechanism

  • 8/10/2019 1-Android Internals 10305904_nimit

    24/36

    Not ideal for transferringlarge data

    Data has to be converted intoParcel

    Limitation of Binder

  • 8/10/2019 1-Android Internals 10305904_nimit

    25/36

    Android Kernel Runtime Walkthrough

    Zygote

    Binder (IPC) Driver

    Layer InteractionJNI

    Contents

  • 8/10/2019 1-Android Internals 10305904_nimit

    26/36

    Application Runtime Service

    lib Application Runtime Service

    Native Service lib

    Application Runtime Service Native Daemon lib

    Depends on type of application,and type of native library.

    Layer Interaction

  • 8/10/2019 1-Android Internals 10305904_nimit

    27/36

    Bridge between Application

    framework layer and Libraries.

    Call gate for languages, like C orC++

    Java Native Interface JNI)

  • 8/10/2019 1-Android Internals 10305904_nimit

    28/36

    Runtime

    Service

  • 8/10/2019 1-Android Internals 10305904_nimit

    29/36

    Example:

    Runtime

    Service

  • 8/10/2019 1-Android Internals 10305904_nimit

    30/36

    Native

    Service

  • 8/10/2019 1-Android Internals 10305904_nimit

    31/36

    Example:

    Native

    Service

  • 8/10/2019 1-Android Internals 10305904_nimit

    32/36

    Native

    Daemon

  • 8/10/2019 1-Android Internals 10305904_nimit

    33/36

    Example:

    Native

    Daemon

  • 8/10/2019 1-Android Internals 10305904_nimit

    34/36

    Image is taken from : https://events.linuxfoundation.org/.../abs2011_yaghmour_internals.ppt

  • 8/10/2019 1-Android Internals 10305904_nimit

    35/36

    References

    A Survey on Android vs. Linux, Frank Maker1 and

    Yu-Hsuan Chan

    Android Interprocess Communication By, ThorstenSchreiber

    Android Devlopers Team, http://developer.android.com/guide/basics/what-is-android.html[Online; accessed on 25-02-2013]

    Patrick Brady, https://sites.google.com/site/io/anatomy--physiology-of-an-android [Online;accessed on 25-02-2013]

  • 8/10/2019 1-Android Internals 10305904_nimit

    36/36

    References

    Jim Huang, http://www.slideshare.net

    /jserv/android-ipc-mechanism [Online; accessed on25-02-2013]