SlideShare a Scribd company logo
1 of 29
Download to read offline
Android internals
     Egor Elizarov
     SPbSU 2012
Legal info
   Android internals by Egor Elizarov is licensed under a
    Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License

   You are free to
      – copy, distribute, display, and perform the work
      – make derivative works
   Under the following conditions
       – Attribution. You must give the original author credit
       – Share Alike. If you alter, transform, or build upon this work, you may
         distribute the resulting work only under a license identical to this one
   All pictures and trademarks are the property of their respective owners. Use of
    these trademarks and pictures is subject to owners permissions.
   Corrections, suggestions, contributions and translations are welcome!



                                          2                                 Egor Elizarov SPbSU 2012
Lecture 6



                                Android IPC
                          Typical Android subsystem


                                                      yegor.yelizarov(at)gmail.com
Rev: 1.1
Last update: 06/01/2012                           http://vk.com/android_internals


                                      3                             Egor Elizarov SPbSU 2012
Previous time

    VM types

    Virtualization approaches

    Dalvik VM features

    Interpreter core types

    JIT algorithm

    Android application start up process

                             4             Egor Elizarov SPbSU 2012
IPC Approaches


    Classic
    – System V IPC
    – Posix IPC


    Modern
    – Binder
    – Cross Memory Attach (CMA)
    – KNEM
    – Kdbus

                         5        Egor Elizarov SPbSU 2012
Linux IPC


    Pipe

    Socket

    Signal

    Semaphore

    Message queue

    Shared memory
                    6       Egor Elizarov SPbSU 2012
Binder


    Lightweight IPC/RPC

    Customized re-implementation of Open Binder

    BeOS -> ACCESS/PalmOS -> Open Binder

    Per process thread pool for processing requests

    Synchronous calls between processes

    Zero copy message transmission
                           7                    Egor Elizarov SPbSU 2012
Socket vs Binder


                                         Binder
          Socket
                               
                                   Associated with PID

    Associated with FD
                               
                                   Local only

    Network transparency
                               
                                   Communication via

    Stream IO read/write
                                   IOCTL


                           8                      Egor Elizarov SPbSU 2012
Binder facilities




        9           Egor Elizarov SPbSU 2012
Parcels and marshalling


    Parcel is a message to be send through Binder

    Different types of data can be marshalled
    (packed) in parcels

    To make remote procedure call binder
    marshalles function arguments and meta data,
    sends it to remote process and unpacks the
    results

                          10                    Egor Elizarov SPbSU 2012
RPC main idea




      11        Egor Elizarov SPbSU 2012
OOP patterns used in Binder


    Bridge



    Mediator



    Proxy



                 12          Egor Elizarov SPbSU 2012
Application layer




        13          Egor Elizarov SPbSU 2012
Application layer transaction




              14          Egor Elizarov SPbSU 2012
Android Interface Definition Language




                  15            Egor Elizarov SPbSU 2012
AIDL example




     16        Egor Elizarov SPbSU 2012
Application layer internals




             17           Egor Elizarov SPbSU 2012
Service Manager

    Special Binder node with known address

    Provide information about existing services

    All services should be registered in Service
    Manager (name & binder token)

    Command line tool: adb service

    sp<IBinder> binder = defaultServiceManager()
    ->getService(String16("media.player"));
                           18                      Egor Elizarov SPbSU 2012
Service Manager workflow




           19         Egor Elizarov SPbSU 2012
Middleware layer



    Provide binder facilities to java framework

    Marshalling/unmarshalling Parcels

    Interaction with kernel

    Managing threads



                              20                  Egor Elizarov SPbSU 2012
Middleware layer internals




            21           Egor Elizarov SPbSU 2012
Kernel layer




     22        Egor Elizarov SPbSU 2012
Binder in action




       23          Egor Elizarov SPbSU 2012
Typical subsytem


    Main logic is implemented in frameworks

    C++ layer contains some servers (Ex:
    mediaserver) connected to java framework via
    Binder

    Use standard external libraries (Ex: libBluez)

    HAL as interface for HW vendors

                           24                   Egor Elizarov SPbSU 2012
Typical subsystem scheme




           25          Egor Elizarov SPbSU 2012
Next Time




    Graphic subsystem

    HW acceleration




                        26   Egor Elizarov SPbSU 2012
Useful links


    http://vk.com/android_internals


    http://0xlab.org/~jserv/android-binder-ipc.pdf


    http://cs736-android.pbworks.com/w/page/5834468/IPC
    %20Binder


    http://www.angryredplanet.com/~hackbod/openbinder/docs/
    html/BinderIPCMechanism.html


    http://mylifewithandroid.blogspot.com/2008/01/about-
    binders.html

                                27                         Egor Elizarov SPbSU 2012
Useful links (2)

    http://free-electrons.com/doc/posix-api.pdf

    http://lwn.net/Articles/466304/

    http://www.slideshare.net/opersys/android-
    internals

    https://github.com/keesj/gomo/wiki/AndroidNati
    veBinder

    http://lwn.net/Articles/472984/
                           28                     Egor Elizarov SPbSU 2012
Thanks to


    Sergey Matyukevich for review and advices
    (www.linkedin.com/pub/sergey-matyukevich/31/889/769)


    Nikolay F. Fominykh for review and advices


    Nikita Shulga for advices and notes
    (http://www.linkedin.com/pub/nikita-shulga/8/582/287)


    Grigory Tolstolytkin for advices and notes
    (http://www.linkedin.com/pub/grigory-
    tolstolytkin/2a/b41/74)


                                29                      Egor Elizarov SPbSU 2012

More Related Content

Viewers also liked

Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)Egor Elizarov
 
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)Egor Elizarov
 
Smart Phone CPU
Smart Phone CPUSmart Phone CPU
Smart Phone CPU오석 한
 
Samsung processors: Exynos family
Samsung processors: Exynos familySamsung processors: Exynos family
Samsung processors: Exynos familySagar Patel
 
Performance Comparison Between x86 and ARM Assembly
Performance Comparison Between x86 and ARM AssemblyPerformance Comparison Between x86 and ARM Assembly
Performance Comparison Between x86 and ARM AssemblyManasa K
 
Motion recognition with Android devices
Motion recognition with Android devicesMotion recognition with Android devices
Motion recognition with Android devicesGabor Paller
 
Android location and sensors API
Android location and sensors APIAndroid location and sensors API
Android location and sensors APIeleksdev
 
Arm corrected ppt
Arm corrected pptArm corrected ppt
Arm corrected pptanish jagan
 
CPU Architectures for Mobile Phone Devices
CPU Architectures for Mobile Phone DevicesCPU Architectures for Mobile Phone Devices
CPU Architectures for Mobile Phone Devicessagar chansaulia
 
Risc and cisc eugene clewlow
Risc and cisc   eugene clewlowRisc and cisc   eugene clewlow
Risc and cisc eugene clewlowManish Prajapati
 
Intel & ARM: Strategic Comparison
Intel & ARM: Strategic ComparisonIntel & ARM: Strategic Comparison
Intel & ARM: Strategic ComparisonToby Allen
 

Viewers also liked (19)

Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)
 
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Game controlling via android
Game controlling via androidGame controlling via android
Game controlling via android
 
Smart Phone CPU
Smart Phone CPUSmart Phone CPU
Smart Phone CPU
 
Samsung processors: Exynos family
Samsung processors: Exynos familySamsung processors: Exynos family
Samsung processors: Exynos family
 
Android Sensors
Android SensorsAndroid Sensors
Android Sensors
 
Review Multicore processing based on ARM architecture
Review Multicore processing based on ARM architectureReview Multicore processing based on ARM architecture
Review Multicore processing based on ARM architecture
 
Introduction to Android Window System
Introduction to Android Window SystemIntroduction to Android Window System
Introduction to Android Window System
 
Performance Comparison Between x86 and ARM Assembly
Performance Comparison Between x86 and ARM AssemblyPerformance Comparison Between x86 and ARM Assembly
Performance Comparison Between x86 and ARM Assembly
 
Motion recognition with Android devices
Motion recognition with Android devicesMotion recognition with Android devices
Motion recognition with Android devices
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Android location and sensors API
Android location and sensors APIAndroid location and sensors API
Android location and sensors API
 
Arm corrected ppt
Arm corrected pptArm corrected ppt
Arm corrected ppt
 
CPU Architectures for Mobile Phone Devices
CPU Architectures for Mobile Phone DevicesCPU Architectures for Mobile Phone Devices
CPU Architectures for Mobile Phone Devices
 
Risc and cisc eugene clewlow
Risc and cisc   eugene clewlowRisc and cisc   eugene clewlow
Risc and cisc eugene clewlow
 
Intel & ARM: Strategic Comparison
Intel & ARM: Strategic ComparisonIntel & ARM: Strategic Comparison
Intel & ARM: Strategic Comparison
 
Risc processors
Risc processorsRisc processors
Risc processors
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 

Similar to Android internals 06 - Binder, Typical subsystem (rev_1.1)

Effortless network response logging on Android
Effortless network response logging on AndroidEffortless network response logging on Android
Effortless network response logging on AndroidSimon Percic
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCFunnelll
 
Readactor-Practical Code Randomization Resilient to Memory Disclosure
Readactor-Practical Code Randomization Resilient to Memory DisclosureReadactor-Practical Code Randomization Resilient to Memory Disclosure
Readactor-Practical Code Randomization Resilient to Memory Disclosurech0psticks
 
Designing An Android Sensor Subsystem and Solving Common Sensor Problems
Designing An Android Sensor Subsystem and Solving Common Sensor ProblemsDesigning An Android Sensor Subsystem and Solving Common Sensor Problems
Designing An Android Sensor Subsystem and Solving Common Sensor ProblemsJen Costillo
 
MongoDB Developer's Notebook, March 2016 -- MongoDB Connector for Business In...
MongoDB Developer's Notebook, March 2016 -- MongoDB Connector for Business In...MongoDB Developer's Notebook, March 2016 -- MongoDB Connector for Business In...
MongoDB Developer's Notebook, March 2016 -- MongoDB Connector for Business In...Daniel M. Farrell
 
An introduction to the Spring Framework
An introduction to the Spring FrameworkAn introduction to the Spring Framework
An introduction to the Spring Frameworkweili_at_slideshare
 
Android Native Development Kit
Android Native Development KitAndroid Native Development Kit
Android Native Development KitPeter R. Egli
 
Setting up a vscode development environment for mbed 5 application using the ...
Setting up a vscode development environment for mbed 5 application using the ...Setting up a vscode development environment for mbed 5 application using the ...
Setting up a vscode development environment for mbed 5 application using the ...Steve Mylroie
 
ELB를 활용한 Socket.IO 멀티노드 구축사례
ELB를 활용한 Socket.IO 멀티노드 구축사례ELB를 활용한 Socket.IO 멀티노드 구축사례
ELB를 활용한 Socket.IO 멀티노드 구축사례Anson Park
 
Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)Mani Sarkar
 
Cross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkCross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkTroy Miles
 
FEL 12 Release Notes
FEL 12 Release NotesFEL 12 Release Notes
FEL 12 Release Noteschitlesh
 
Spring Architecture | Advanced Java
Spring Architecture | Advanced JavaSpring Architecture | Advanced Java
Spring Architecture | Advanced JavaVISHAL DONGA
 
COBOL deployment to .Net or JVM - Developer Day
COBOL deployment to .Net or JVM - Developer DayCOBOL deployment to .Net or JVM - Developer Day
COBOL deployment to .Net or JVM - Developer DayMicro Focus
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFrameworkShankar Nair
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalNAVER D2
 
Os Grossupdated
Os GrossupdatedOs Grossupdated
Os Grossupdatedoscon2007
 
[JavaOne] Demystifying WebSockets - Build a Cool, Real-time Multi-player Game...
[JavaOne] Demystifying WebSockets - Build a Cool, Real-time Multi-player Game...[JavaOne] Demystifying WebSockets - Build a Cool, Real-time Multi-player Game...
[JavaOne] Demystifying WebSockets - Build a Cool, Real-time Multi-player Game...Vivek Ganesan
 

Similar to Android internals 06 - Binder, Typical subsystem (rev_1.1) (20)

Effortless network response logging on Android
Effortless network response logging on AndroidEffortless network response logging on Android
Effortless network response logging on Android
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoC
 
Readactor-Practical Code Randomization Resilient to Memory Disclosure
Readactor-Practical Code Randomization Resilient to Memory DisclosureReadactor-Practical Code Randomization Resilient to Memory Disclosure
Readactor-Practical Code Randomization Resilient to Memory Disclosure
 
Designing An Android Sensor Subsystem and Solving Common Sensor Problems
Designing An Android Sensor Subsystem and Solving Common Sensor ProblemsDesigning An Android Sensor Subsystem and Solving Common Sensor Problems
Designing An Android Sensor Subsystem and Solving Common Sensor Problems
 
MongoDB Developer's Notebook, March 2016 -- MongoDB Connector for Business In...
MongoDB Developer's Notebook, March 2016 -- MongoDB Connector for Business In...MongoDB Developer's Notebook, March 2016 -- MongoDB Connector for Business In...
MongoDB Developer's Notebook, March 2016 -- MongoDB Connector for Business In...
 
An introduction to the Spring Framework
An introduction to the Spring FrameworkAn introduction to the Spring Framework
An introduction to the Spring Framework
 
Android Native Development Kit
Android Native Development KitAndroid Native Development Kit
Android Native Development Kit
 
Spring notes
Spring notesSpring notes
Spring notes
 
Setting up a vscode development environment for mbed 5 application using the ...
Setting up a vscode development environment for mbed 5 application using the ...Setting up a vscode development environment for mbed 5 application using the ...
Setting up a vscode development environment for mbed 5 application using the ...
 
ELB를 활용한 Socket.IO 멀티노드 구축사례
ELB를 활용한 Socket.IO 멀티노드 구축사례ELB를 활용한 Socket.IO 멀티노드 구축사례
ELB를 활용한 Socket.IO 멀티노드 구축사례
 
Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)
 
Cross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic FrameworkCross Platform Mobile Apps with the Ionic Framework
Cross Platform Mobile Apps with the Ionic Framework
 
FEL 12 Release Notes
FEL 12 Release NotesFEL 12 Release Notes
FEL 12 Release Notes
 
Spring Architecture | Advanced Java
Spring Architecture | Advanced JavaSpring Architecture | Advanced Java
Spring Architecture | Advanced Java
 
COBOL deployment to .Net or JVM - Developer Day
COBOL deployment to .Net or JVM - Developer DayCOBOL deployment to .Net or JVM - Developer Day
COBOL deployment to .Net or JVM - Developer Day
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFramework
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_final
 
Os Grossupdated
Os GrossupdatedOs Grossupdated
Os Grossupdated
 
[JavaOne] Demystifying WebSockets - Build a Cool, Real-time Multi-player Game...
[JavaOne] Demystifying WebSockets - Build a Cool, Real-time Multi-player Game...[JavaOne] Demystifying WebSockets - Build a Cool, Real-time Multi-player Game...
[JavaOne] Demystifying WebSockets - Build a Cool, Real-time Multi-player Game...
 
Molome infrastructure
Molome infrastructureMolome infrastructure
Molome infrastructure
 

Recently uploaded

ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 

Recently uploaded (20)

ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 

Android internals 06 - Binder, Typical subsystem (rev_1.1)

  • 1. Android internals Egor Elizarov SPbSU 2012
  • 2. Legal info  Android internals by Egor Elizarov is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License  You are free to – copy, distribute, display, and perform the work – make derivative works  Under the following conditions – Attribution. You must give the original author credit – Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one  All pictures and trademarks are the property of their respective owners. Use of these trademarks and pictures is subject to owners permissions.  Corrections, suggestions, contributions and translations are welcome! 2 Egor Elizarov SPbSU 2012
  • 3. Lecture 6 Android IPC Typical Android subsystem yegor.yelizarov(at)gmail.com Rev: 1.1 Last update: 06/01/2012 http://vk.com/android_internals 3 Egor Elizarov SPbSU 2012
  • 4. Previous time  VM types  Virtualization approaches  Dalvik VM features  Interpreter core types  JIT algorithm  Android application start up process 4 Egor Elizarov SPbSU 2012
  • 5. IPC Approaches  Classic – System V IPC – Posix IPC  Modern – Binder – Cross Memory Attach (CMA) – KNEM – Kdbus 5 Egor Elizarov SPbSU 2012
  • 6. Linux IPC  Pipe  Socket  Signal  Semaphore  Message queue  Shared memory 6 Egor Elizarov SPbSU 2012
  • 7. Binder  Lightweight IPC/RPC  Customized re-implementation of Open Binder  BeOS -> ACCESS/PalmOS -> Open Binder  Per process thread pool for processing requests  Synchronous calls between processes  Zero copy message transmission 7 Egor Elizarov SPbSU 2012
  • 8. Socket vs Binder Binder Socket  Associated with PID  Associated with FD  Local only  Network transparency  Communication via  Stream IO read/write IOCTL 8 Egor Elizarov SPbSU 2012
  • 9. Binder facilities 9 Egor Elizarov SPbSU 2012
  • 10. Parcels and marshalling  Parcel is a message to be send through Binder  Different types of data can be marshalled (packed) in parcels  To make remote procedure call binder marshalles function arguments and meta data, sends it to remote process and unpacks the results 10 Egor Elizarov SPbSU 2012
  • 11. RPC main idea 11 Egor Elizarov SPbSU 2012
  • 12. OOP patterns used in Binder  Bridge  Mediator  Proxy 12 Egor Elizarov SPbSU 2012
  • 13. Application layer 13 Egor Elizarov SPbSU 2012
  • 14. Application layer transaction 14 Egor Elizarov SPbSU 2012
  • 15. Android Interface Definition Language 15 Egor Elizarov SPbSU 2012
  • 16. AIDL example 16 Egor Elizarov SPbSU 2012
  • 17. Application layer internals 17 Egor Elizarov SPbSU 2012
  • 18. Service Manager  Special Binder node with known address  Provide information about existing services  All services should be registered in Service Manager (name & binder token)  Command line tool: adb service  sp<IBinder> binder = defaultServiceManager() ->getService(String16("media.player")); 18 Egor Elizarov SPbSU 2012
  • 19. Service Manager workflow 19 Egor Elizarov SPbSU 2012
  • 20. Middleware layer  Provide binder facilities to java framework  Marshalling/unmarshalling Parcels  Interaction with kernel  Managing threads 20 Egor Elizarov SPbSU 2012
  • 21. Middleware layer internals 21 Egor Elizarov SPbSU 2012
  • 22. Kernel layer 22 Egor Elizarov SPbSU 2012
  • 23. Binder in action 23 Egor Elizarov SPbSU 2012
  • 24. Typical subsytem  Main logic is implemented in frameworks  C++ layer contains some servers (Ex: mediaserver) connected to java framework via Binder  Use standard external libraries (Ex: libBluez)  HAL as interface for HW vendors 24 Egor Elizarov SPbSU 2012
  • 25. Typical subsystem scheme 25 Egor Elizarov SPbSU 2012
  • 26. Next Time  Graphic subsystem  HW acceleration 26 Egor Elizarov SPbSU 2012
  • 27. Useful links  http://vk.com/android_internals  http://0xlab.org/~jserv/android-binder-ipc.pdf  http://cs736-android.pbworks.com/w/page/5834468/IPC %20Binder  http://www.angryredplanet.com/~hackbod/openbinder/docs/ html/BinderIPCMechanism.html  http://mylifewithandroid.blogspot.com/2008/01/about- binders.html 27 Egor Elizarov SPbSU 2012
  • 28. Useful links (2)  http://free-electrons.com/doc/posix-api.pdf  http://lwn.net/Articles/466304/  http://www.slideshare.net/opersys/android- internals  https://github.com/keesj/gomo/wiki/AndroidNati veBinder  http://lwn.net/Articles/472984/ 28 Egor Elizarov SPbSU 2012
  • 29. Thanks to  Sergey Matyukevich for review and advices (www.linkedin.com/pub/sergey-matyukevich/31/889/769)  Nikolay F. Fominykh for review and advices  Nikita Shulga for advices and notes (http://www.linkedin.com/pub/nikita-shulga/8/582/287)  Grigory Tolstolytkin for advices and notes (http://www.linkedin.com/pub/grigory- tolstolytkin/2a/b41/74) 29 Egor Elizarov SPbSU 2012