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

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 

Recently uploaded (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 

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