SlideShare a Scribd company logo
1 of 31
Inter-process communication of Android Tetsuyuki Kobayashi 2011.6.3  updated
Who am I? ,[object Object]
10 years in embedded Java Virtual Machine
Now GCC, Linux, QEMU, Android, … ,[object Object],[object Object]
http://blog.kmckk.com/  (Corporate)
http://kobablog.wordpress.com/ (English) ,[object Object],[object Object],new
Today's topic ,[object Object]
Inter process method invocation using Binder
Ashmem
System Properties
Processes running on Android $ ps ... root  37  1  248  156  c00aef2c 0000875c S /sbin/ueventd system  42  1  768  260  c022950c afd0b6fc S /system/bin/servicemanager root  43  1  3824  564  ffffffff afd0bdac S /system/bin/vold root  44  1  3796  560  ffffffff afd0bdac S /system/bin/netd root  45  1  628  264  c02588c0 afd0c0cc S /system/bin/debuggerd radio  46  1  4336  672  ffffffff afd0bdac S /system/bin/rild root  47  1  62224  27576 c00aef2c afd0b844 S zygote media  48  1  16828  3736  ffffffff afd0b6fc S /system/bin/mediaserver bluetooth 49  1  1216  572  c00aef2c afd0c59c S /system/bin/dbus-daemon root  50  1  776  316  c02a8424 afd0b45c S /system/bin/installd keystore  51  1  1704  432  c02588c0 afd0c0cc S /system/bin/keystore shell  52  1  696  336  c0050934 afd0c3ac S /system/bin/sh root  53  1  3356  160  ffffffff 00008294 S /sbin/adbd system  67  47  172464 32596 ffffffff afd0b6fc S system_server system  115  47  80028  20728 ffffffff afd0c51c S com.android.systemui app_24  124  47  80732  20720 ffffffff afd0c51c S com.android.inputmethod.latin radio  135  47  87848  20324 ffffffff afd0c51c S com.android.phone app_18  144  47  89136  24160 ffffffff afd0c51c S com.android.launcher app_7  165  47  86136  22736 ffffffff afd0c51c S android.process.acore app_0  197  47  73996  17472 ffffffff afd0c51c S com.android.deskclock app_14  208  47  75000  18464 ffffffff afd0c51c S android.process.media app_3  219  47  72228  17652 ffffffff afd0c51c S com.android.bluetooth app_25  234  47  85336  17836 ffffffff afd0c51c S com.android.mms app_26  254  47  74656  19080 ffffffff afd0c51c S com.android.email app_27  266  47  74912  18100 ffffffff afd0c51c S com.android.providers.calendar app_1  285  47  71616  16280 ffffffff afd0c51c S com.android.protips app_19  293  47  72184  16572 ffffffff afd0c51c S com.android.music app_21  301  47  74728  17208 ffffffff afd0c51c S com.android.quicksearchbox app_28  311  47  75408  18040 ffffffff afd0c51c S com.cooliris.media shell  323  52  856  316  00000000 afd0b45c R ps $ More than 30 processes (200+ threads).
Kernel Inter Process Communication
Abstraction of Inter Process Communication Binder AIDL Intent More abstract
Inter Process Communication of Android ,[object Object]
Intent (1) ,[object Object]
Requests are queued and handled sequentially.
Powerful enough between applications
Implemented using inter process method invocation
Intent (2) ,[object Object]
The sender can specify ”action”. Then proper receiver is chosen and handles it. ,[object Object]
VIEW + geo:0,0?q=Tokyo -> Map app shows a map of Tokyo.
CALL + tel:01234567 -> Phone app dials the number.
Inter process method invocation ,[object Object]
needs multi-thread programming
wrapped by AIDL to hide complexity
implemented using binder
Invoking method via interface In the same process
Inter-process invocation interface interface interface How?
Inter-process invocation Binder Thread interface interface interface
android.os.Parcel ” flatten” ” unflatten” transmit Delivering arguments of method
Describing in UML ... implements

More Related Content

What's hot

Android binder introduction
Android binder introductionAndroid binder introduction
Android binder introductionDerek Fang
 
Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for LinuxYu-Hsin Hung
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UIOpersys inc.
 
Android AIDL Concept
Android AIDL ConceptAndroid AIDL Concept
Android AIDL ConceptCharile Tsai
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverNanik Tolaram
 
Understanding binder in android
Understanding binder in androidUnderstanding binder in android
Understanding binder in androidHaifeng Li
 
Android internals By Rajesh Khetan
Android internals By Rajesh KhetanAndroid internals By Rajesh Khetan
Android internals By Rajesh KhetanRajesh Khetan
 
Android service, aidl - day 1
Android service, aidl - day 1Android service, aidl - day 1
Android service, aidl - day 1Utkarsh Mankad
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debuggingAshish Agrawal
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
 

What's hot (20)

Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)
 
Android binder introduction
Android binder introductionAndroid binder introduction
Android binder introduction
 
Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for Linux
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UI
 
Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
Android AIDL Concept
Android AIDL ConceptAndroid AIDL Concept
Android AIDL Concept
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
Understanding binder in android
Understanding binder in androidUnderstanding binder in android
Understanding binder in android
 
Android internals By Rajesh Khetan
Android internals By Rajesh KhetanAndroid internals By Rajesh Khetan
Android internals By Rajesh Khetan
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Android service, aidl - day 1
Android service, aidl - day 1Android service, aidl - day 1
Android service, aidl - day 1
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
Init of Android
Init of AndroidInit of Android
Init of Android
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
Applied Computer Science Concepts in Android
Applied Computer Science Concepts in AndroidApplied Computer Science Concepts in Android
Applied Computer Science Concepts in Android
 
Design and Concepts of Android Graphics
Design and Concepts of Android GraphicsDesign and Concepts of Android Graphics
Design and Concepts of Android Graphics
 

Viewers also liked

Binderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidBinderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidl_b__
 
Android起動周りのノウハウ
Android起動周りのノウハウAndroid起動周りのノウハウ
Android起動周りのノウハウchancelab
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Ravindra Raju Kolahalam
 
Etsy - Android & Design
Etsy - Android & DesignEtsy - Android & Design
Etsy - Android & DesignDeniz Veli
 
Advanced Android Design Implementation
Advanced Android Design ImplementationAdvanced Android Design Implementation
Advanced Android Design ImplementationTack Mobile
 
June 2014 - IPC in android
June 2014 - IPC in androidJune 2014 - IPC in android
June 2014 - IPC in androidBlrDroid
 
Binderのはじめの一歩
Binderのはじめの一歩Binderのはじめの一歩
Binderのはじめの一歩l_b__
 
AIDL - Android Interface Definition Language
AIDL  - Android Interface Definition LanguageAIDL  - Android Interface Definition Language
AIDL - Android Interface Definition LanguageArvind Devaraj
 
Inter Process Communication-R.D.Sivakumar
Inter Process Communication-R.D.SivakumarInter Process Communication-R.D.Sivakumar
Inter Process Communication-R.D.SivakumarSivakumar R D .
 
Permission use analysis for vetting undesirable behavior in
Permission use analysis for vetting undesirable behavior inPermission use analysis for vetting undesirable behavior in
Permission use analysis for vetting undesirable behavior inchaitrabhat777
 
Java & The Android Stack: A Security Analysis
Java & The Android Stack: A Security AnalysisJava & The Android Stack: A Security Analysis
Java & The Android Stack: A Security AnalysisPragati Rai
 
Intents and PendingIntents in Android application development
Intents and PendingIntents in Android application developmentIntents and PendingIntents in Android application development
Intents and PendingIntents in Android application developmentMaryadelMar85
 
Android Material Design APIs/Tips
Android Material Design APIs/TipsAndroid Material Design APIs/Tips
Android Material Design APIs/TipsKen Yee
 
Android Crash analysis and The Dalvik Garbage collector – Tools and Tips
Android Crash analysis and The Dalvik Garbage collector – Tools and TipsAndroid Crash analysis and The Dalvik Garbage collector – Tools and Tips
Android Crash analysis and The Dalvik Garbage collector – Tools and TipsDroidConTLV
 
Desgn&imp authentctn.ppt by Jaseela
Desgn&imp authentctn.ppt by JaseelaDesgn&imp authentctn.ppt by Jaseela
Desgn&imp authentctn.ppt by JaseelaStudent
 
Inter process communication
Inter process communicationInter process communication
Inter process communicationPradeep Kumar TS
 
Manipulating Android tasks and back stack
Manipulating Android tasks and back stackManipulating Android tasks and back stack
Manipulating Android tasks and back stackRan Nachmany
 

Viewers also liked (20)

Android binder-ipc
Android binder-ipcAndroid binder-ipc
Android binder-ipc
 
Binderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidBinderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroid
 
Android起動周りのノウハウ
Android起動周りのノウハウAndroid起動周りのノウハウ
Android起動周りのノウハウ
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
 
Etsy - Android & Design
Etsy - Android & DesignEtsy - Android & Design
Etsy - Android & Design
 
Advanced Android Design Implementation
Advanced Android Design ImplementationAdvanced Android Design Implementation
Advanced Android Design Implementation
 
June 2014 - IPC in android
June 2014 - IPC in androidJune 2014 - IPC in android
June 2014 - IPC in android
 
Binderのはじめの一歩
Binderのはじめの一歩Binderのはじめの一歩
Binderのはじめの一歩
 
Android local sockets in native code
Android local sockets in native code Android local sockets in native code
Android local sockets in native code
 
AIDL - Android Interface Definition Language
AIDL  - Android Interface Definition LanguageAIDL  - Android Interface Definition Language
AIDL - Android Interface Definition Language
 
Inter Process Communication-R.D.Sivakumar
Inter Process Communication-R.D.SivakumarInter Process Communication-R.D.Sivakumar
Inter Process Communication-R.D.Sivakumar
 
Permission use analysis for vetting undesirable behavior in
Permission use analysis for vetting undesirable behavior inPermission use analysis for vetting undesirable behavior in
Permission use analysis for vetting undesirable behavior in
 
Java & The Android Stack: A Security Analysis
Java & The Android Stack: A Security AnalysisJava & The Android Stack: A Security Analysis
Java & The Android Stack: A Security Analysis
 
Intents and PendingIntents in Android application development
Intents and PendingIntents in Android application developmentIntents and PendingIntents in Android application development
Intents and PendingIntents in Android application development
 
Understanding open max il
Understanding open max ilUnderstanding open max il
Understanding open max il
 
Android Material Design APIs/Tips
Android Material Design APIs/TipsAndroid Material Design APIs/Tips
Android Material Design APIs/Tips
 
Android Crash analysis and The Dalvik Garbage collector – Tools and Tips
Android Crash analysis and The Dalvik Garbage collector – Tools and TipsAndroid Crash analysis and The Dalvik Garbage collector – Tools and Tips
Android Crash analysis and The Dalvik Garbage collector – Tools and Tips
 
Desgn&imp authentctn.ppt by Jaseela
Desgn&imp authentctn.ppt by JaseelaDesgn&imp authentctn.ppt by Jaseela
Desgn&imp authentctn.ppt by Jaseela
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
Manipulating Android tasks and back stack
Manipulating Android tasks and back stackManipulating Android tasks and back stack
Manipulating Android tasks and back stack
 

Similar to Inter-process communication of Android

Embedded Android
Embedded AndroidEmbedded Android
Embedded Android晓东 杜
 
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹GangSeok Lee
 
Android Radio Layer Interface
Android Radio Layer InterfaceAndroid Radio Layer Interface
Android Radio Layer InterfaceChun-Yu Wang
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in actionStefano Sanna
 
Optimizing Apps for Better Performance
Optimizing Apps for Better PerformanceOptimizing Apps for Better Performance
Optimizing Apps for Better PerformanceElif Boncuk
 
Vulnerable Out of the Box: An Evaluation of Android Carrier Devices
Vulnerable Out of the Box: An Evaluation of Android Carrier DevicesVulnerable Out of the Box: An Evaluation of Android Carrier Devices
Vulnerable Out of the Box: An Evaluation of Android Carrier DevicesPriyanka Aash
 
Stability issues of user space
Stability issues of user spaceStability issues of user space
Stability issues of user space晓东 杜
 
IRJET - Mirroring of Source and Sink Devices in Android Screen Casting
IRJET - Mirroring of Source and Sink Devices in Android Screen CastingIRJET - Mirroring of Source and Sink Devices in Android Screen Casting
IRJET - Mirroring of Source and Sink Devices in Android Screen CastingIRJET Journal
 
Android Embedded - Smart Hubs als Schaltzentrale des IoT
Android Embedded - Smart Hubs als Schaltzentrale des IoTAndroid Embedded - Smart Hubs als Schaltzentrale des IoT
Android Embedded - Smart Hubs als Schaltzentrale des IoTinovex GmbH
 
Android 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and NetworkAndroid 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and NetworkCaio Pereira
 
Android Programming made easy
Android Programming made easyAndroid Programming made easy
Android Programming made easyLars Vogel
 
Android 5.0 Lollipop platform change investigation report
Android 5.0 Lollipop platform change investigation reportAndroid 5.0 Lollipop platform change investigation report
Android 5.0 Lollipop platform change investigation reporthidenorly
 
Eclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for MicrocontrollersEclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for MicrocontrollersMicroEJ
 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsPositive Hack Days
 
Roll your own toy unix clone os
Roll your own toy unix clone osRoll your own toy unix clone os
Roll your own toy unix clone oseramax
 
J2me Crash Course
J2me Crash CourseJ2me Crash Course
J2me Crash Courseguest860a03
 

Similar to Inter-process communication of Android (20)

Embedded Android
Embedded AndroidEmbedded Android
Embedded Android
 
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
 
Android Development Tools
Android Development ToolsAndroid Development Tools
Android Development Tools
 
Android Radio Layer Interface
Android Radio Layer InterfaceAndroid Radio Layer Interface
Android Radio Layer Interface
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in action
 
Optimizing Apps for Better Performance
Optimizing Apps for Better PerformanceOptimizing Apps for Better Performance
Optimizing Apps for Better Performance
 
Vulnerable Out of the Box: An Evaluation of Android Carrier Devices
Vulnerable Out of the Box: An Evaluation of Android Carrier DevicesVulnerable Out of the Box: An Evaluation of Android Carrier Devices
Vulnerable Out of the Box: An Evaluation of Android Carrier Devices
 
Vinod report es 1
Vinod report es   1Vinod report es   1
Vinod report es 1
 
Vinod report es 1
Vinod report es   1Vinod report es   1
Vinod report es 1
 
Stability issues of user space
Stability issues of user spaceStability issues of user space
Stability issues of user space
 
Android Development Tools
Android Development ToolsAndroid Development Tools
Android Development Tools
 
IRJET - Mirroring of Source and Sink Devices in Android Screen Casting
IRJET - Mirroring of Source and Sink Devices in Android Screen CastingIRJET - Mirroring of Source and Sink Devices in Android Screen Casting
IRJET - Mirroring of Source and Sink Devices in Android Screen Casting
 
Android Embedded - Smart Hubs als Schaltzentrale des IoT
Android Embedded - Smart Hubs als Schaltzentrale des IoTAndroid Embedded - Smart Hubs als Schaltzentrale des IoT
Android Embedded - Smart Hubs als Schaltzentrale des IoT
 
Android 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and NetworkAndroid 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and Network
 
Android Programming made easy
Android Programming made easyAndroid Programming made easy
Android Programming made easy
 
Android 5.0 Lollipop platform change investigation report
Android 5.0 Lollipop platform change investigation reportAndroid 5.0 Lollipop platform change investigation report
Android 5.0 Lollipop platform change investigation report
 
Eclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for MicrocontrollersEclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for Microcontrollers
 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android Applications
 
Roll your own toy unix clone os
Roll your own toy unix clone osRoll your own toy unix clone os
Roll your own toy unix clone os
 
J2me Crash Course
J2me Crash CourseJ2me Crash Course
J2me Crash Course
 

More from Tetsuyuki Kobayashi

Try new transport protocol SRT (ver. 2)
Try new transport protocol SRT  (ver. 2)Try new transport protocol SRT  (ver. 2)
Try new transport protocol SRT (ver. 2)Tetsuyuki Kobayashi
 
Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機
Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機
Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機Tetsuyuki Kobayashi
 
WebOS Open Source Edition を試してみた
WebOS Open Source Edition を試してみたWebOS Open Source Edition を試してみた
WebOS Open Source Edition を試してみたTetsuyuki Kobayashi
 
Linuxのユーザーランドをinitから全てまるごとgolangで書く
Linuxのユーザーランドをinitから全てまるごとgolangで書くLinuxのユーザーランドをinitから全てまるごとgolangで書く
Linuxのユーザーランドをinitから全てまるごとgolangで書くTetsuyuki Kobayashi
 
組み込みLinuxでのGolangのススメ(Go con版)
組み込みLinuxでのGolangのススメ(Go con版)組み込みLinuxでのGolangのススメ(Go con版)
組み込みLinuxでのGolangのススメ(Go con版)Tetsuyuki Kobayashi
 
組み込みLinuxでのGolangのススメ
組み込みLinuxでのGolangのススメ組み込みLinuxでのGolangのススメ
組み込みLinuxでのGolangのススメTetsuyuki Kobayashi
 
Tricky implementation of Go ARM soft float
Tricky implementation of Go ARM soft floatTricky implementation of Go ARM soft float
Tricky implementation of Go ARM soft floatTetsuyuki Kobayashi
 
Simple and efficient way to get the last log using MMAP
Simple and efficient way to get the last log using MMAPSimple and efficient way to get the last log using MMAP
Simple and efficient way to get the last log using MMAPTetsuyuki Kobayashi
 
Basic of virtual memory of Linux
Basic of virtual memory of LinuxBasic of virtual memory of Linux
Basic of virtual memory of LinuxTetsuyuki Kobayashi
 
ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?Tetsuyuki Kobayashi
 
Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'Tetsuyuki Kobayashi
 

More from Tetsuyuki Kobayashi (20)

some topic of ffmpeg
some topic of ffmpeg some topic of ffmpeg
some topic of ffmpeg
 
New VIdeo CODEC AV1
New VIdeo CODEC AV1 New VIdeo CODEC AV1
New VIdeo CODEC AV1
 
Try new transport protocol SRT (ver. 2)
Try new transport protocol SRT  (ver. 2)Try new transport protocol SRT  (ver. 2)
Try new transport protocol SRT (ver. 2)
 
Try new transport protocol SRT
Try new transport protocol SRTTry new transport protocol SRT
Try new transport protocol SRT
 
Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機
Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機
Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機
 
WebOS Open Source Edition を試してみた
WebOS Open Source Edition を試してみたWebOS Open Source Edition を試してみた
WebOS Open Source Edition を試してみた
 
Linuxのユーザーランドをinitから全てまるごとgolangで書く
Linuxのユーザーランドをinitから全てまるごとgolangで書くLinuxのユーザーランドをinitから全てまるごとgolangで書く
Linuxのユーザーランドをinitから全てまるごとgolangで書く
 
組み込みLinuxでのGolangのススメ(Go con版)
組み込みLinuxでのGolangのススメ(Go con版)組み込みLinuxでのGolangのススメ(Go con版)
組み込みLinuxでのGolangのススメ(Go con版)
 
組み込みLinuxでのGolangのススメ
組み込みLinuxでのGolangのススメ組み込みLinuxでのGolangのススメ
組み込みLinuxでのGolangのススメ
 
Tricky implementation of Go ARM soft float
Tricky implementation of Go ARM soft floatTricky implementation of Go ARM soft float
Tricky implementation of Go ARM soft float
 
ARM 64bit has come!
ARM 64bit has come!ARM 64bit has come!
ARM 64bit has come!
 
Virtual memory 20070222-en
Virtual memory 20070222-enVirtual memory 20070222-en
Virtual memory 20070222-en
 
Simple and efficient way to get the last log using MMAP
Simple and efficient way to get the last log using MMAPSimple and efficient way to get the last log using MMAP
Simple and efficient way to get the last log using MMAP
 
Tips of Malloc & Free
Tips of Malloc & FreeTips of Malloc & Free
Tips of Malloc & Free
 
Basic of virtual memory of Linux
Basic of virtual memory of LinuxBasic of virtual memory of Linux
Basic of virtual memory of Linux
 
Patch101
Patch101Patch101
Patch101
 
ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?
 
Tweaking Google TV emulator
Tweaking Google TV emulatorTweaking Google TV emulator
Tweaking Google TV emulator
 
Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'
 
Android ipm 20110409
Android ipm 20110409Android ipm 20110409
Android ipm 20110409
 

Recently uploaded

Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxFIDO Alliance
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaWSO2
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingScyllaDB
 
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...SOFTTECHHUB
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformWSO2
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxMarkSteadman7
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 

Recently uploaded (20)

Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 

Inter-process communication of Android

  • 1. Inter-process communication of Android Tetsuyuki Kobayashi 2011.6.3 updated
  • 2.
  • 3. 10 years in embedded Java Virtual Machine
  • 4.
  • 6.
  • 7.
  • 8. Inter process method invocation using Binder
  • 11. Processes running on Android $ ps ... root 37 1 248 156 c00aef2c 0000875c S /sbin/ueventd system 42 1 768 260 c022950c afd0b6fc S /system/bin/servicemanager root 43 1 3824 564 ffffffff afd0bdac S /system/bin/vold root 44 1 3796 560 ffffffff afd0bdac S /system/bin/netd root 45 1 628 264 c02588c0 afd0c0cc S /system/bin/debuggerd radio 46 1 4336 672 ffffffff afd0bdac S /system/bin/rild root 47 1 62224 27576 c00aef2c afd0b844 S zygote media 48 1 16828 3736 ffffffff afd0b6fc S /system/bin/mediaserver bluetooth 49 1 1216 572 c00aef2c afd0c59c S /system/bin/dbus-daemon root 50 1 776 316 c02a8424 afd0b45c S /system/bin/installd keystore 51 1 1704 432 c02588c0 afd0c0cc S /system/bin/keystore shell 52 1 696 336 c0050934 afd0c3ac S /system/bin/sh root 53 1 3356 160 ffffffff 00008294 S /sbin/adbd system 67 47 172464 32596 ffffffff afd0b6fc S system_server system 115 47 80028 20728 ffffffff afd0c51c S com.android.systemui app_24 124 47 80732 20720 ffffffff afd0c51c S com.android.inputmethod.latin radio 135 47 87848 20324 ffffffff afd0c51c S com.android.phone app_18 144 47 89136 24160 ffffffff afd0c51c S com.android.launcher app_7 165 47 86136 22736 ffffffff afd0c51c S android.process.acore app_0 197 47 73996 17472 ffffffff afd0c51c S com.android.deskclock app_14 208 47 75000 18464 ffffffff afd0c51c S android.process.media app_3 219 47 72228 17652 ffffffff afd0c51c S com.android.bluetooth app_25 234 47 85336 17836 ffffffff afd0c51c S com.android.mms app_26 254 47 74656 19080 ffffffff afd0c51c S com.android.email app_27 266 47 74912 18100 ffffffff afd0c51c S com.android.providers.calendar app_1 285 47 71616 16280 ffffffff afd0c51c S com.android.protips app_19 293 47 72184 16572 ffffffff afd0c51c S com.android.music app_21 301 47 74728 17208 ffffffff afd0c51c S com.android.quicksearchbox app_28 311 47 75408 18040 ffffffff afd0c51c S com.cooliris.media shell 323 52 856 316 00000000 afd0b45c R ps $ More than 30 processes (200+ threads).
  • 12. Kernel Inter Process Communication
  • 13. Abstraction of Inter Process Communication Binder AIDL Intent More abstract
  • 14.
  • 15.
  • 16. Requests are queued and handled sequentially.
  • 17. Powerful enough between applications
  • 18. Implemented using inter process method invocation
  • 19.
  • 20.
  • 21. VIEW + geo:0,0?q=Tokyo -> Map app shows a map of Tokyo.
  • 22. CALL + tel:01234567 -> Phone app dials the number.
  • 23.
  • 25. wrapped by AIDL to hide complexity
  • 27. Invoking method via interface In the same process
  • 28. Inter-process invocation interface interface interface How?
  • 29. Inter-process invocation Binder Thread interface interface interface
  • 30. android.os.Parcel ” flatten” ” unflatten” transmit Delivering arguments of method
  • 31. Describing in UML ... implements
  • 32. Describing in UML ... calls implements extends
  • 33. AIDL Auto generated from .aidl file
  • 34. Kernel Use case: Who calls ”onPause” in Activity? Activity queue 3:”onPause” is called in main thread 1:Call ”schedulePauseActivity” across process 2:Send message by Handler
  • 35.
  • 36. Not for general purpose. Tuned for specific transaction.
  • 37.
  • 38. (CF. Socket have internal status per fd.)
  • 39. Comparing binder with socket socket binder internal status associated to FD associated to PID (FD can be shared among threads in the same process) read & write operation as a stream done at once by ”ioctl” network transparency Yes No expects local only
  • 40. Transaction of Binder (1) if ( ioctl (fd, BINDER_WRITE_READ, &bwt ) >= 0) err = NO_ERROR; else err = -errno; write_size write_consumed write_buffer read_size read_consumed read_buffer binder_write_read
  • 41. Transaction of Binder (2) Process A Process B Binder Process A Binder Process B Copy memory by copy_from _user Copy memory by copy_to_user Then, wake up process B Process A and B have different memory space. They can not see each other. Kernel Kernel
  • 42.
  • 44. int ashmem_pin_region(int fd, size_t offset, size_t len)
  • 45.
  • 46. Similar to weak reference of Java. useful to implement cache.
  • 48.
  • 49. Shared among all processes.
  • 50. Init process has the master data.
  • 51. The other processes have read-only copy.
  • 52. Init process handles write request to the master data.
  • 53. implemented using ashmem before Gingerbread.
  • 54. At Gingerbread changed not to use ashmem.
  • 55. Example of System Properties ... [ro.bt.bdaddr_path]: [/sys/module/board_mahimahi/parameters/bdaddr] [ro.ril.def.agps.mode]: [2] [ro.ril.fast.dormancy.rule]: [1] [ro.ril.fd.scron.timeout]: [4] [ro.ril.fd.scroff.timeout]: [3] [ro.ril.gprsclass]: [10] [init.svc.adbd]: [running] [ril.reload.count]: [1] [init.svc.bootanim]: [stopped] [hw.keyboards.0.devname]: [mahimahi-keypad] [hw.keyboards.65537.devname]: [mahimahi-keypad] [hw.keyboards.131075.devname]: [h2w headset] [net.hostname]: [android_200142d4dfd0d25c] [dev.bootcomplete]: [1] [gsm.version.ril-impl]: [HTC-RIL 2.2.1001G (Jul 16 2010,21:52:13)] [gsm.sim.operator.numeric]: [] [gsm.sim.operator.alpha]: [] [gsm.sim.operator.iso-country]: [] [gsm.sim.state]: [ABSENT] [gsm.current.phone-type]: [1] [wlan.driver.status]: [ok] [init.svc.wpa_supplicant]: [running] ...
  • 56.
  • 57.
  • 58. Reading System Property Kernel init Other processes /dev/__properties__ (on tmpfs) mmap (read/write) mmap (read only) Just read the property in each process.
  • 59. Writing System Property Kernel init Other processes /dev/__properties__ (on tmpfs) mmap (read/write) mmap (read only) Send write request to init through socket
  • 60. Actual code of initialize System Properties fd = open (&quot;/dev/__properties__&quot;, O_RDWR | O_CREAT, 0600); if (fd < 0) return -1; if ( ftruncate (fd, size) < 0) goto out; data = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if(data == MAP_FAILED) goto out; close (fd); fd = open (&quot;/dev/__properties__&quot;, O_RDONLY); if (fd < 0) return -1; unlink (&quot;/dev/__properties__&quot;); $(ANDROID_TOP)/system/core/init/property_service.c Give this fd to other processes. No longer access by file name. /dev is a tmpfs
  • 61.
  • 67. Q&A and demo http://www.kmckk.co.jp/eng/kzma9/ http://www.kmckk.co.jp/eng/jet_index.html