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

Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 

Recently uploaded (20)

Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 

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