Upload
egor-elizarov
View
3.720
Download
12
Tags:
Embed Size (px)
DESCRIPTION
Course: Android Internals Lecture 6: Binder, Typical subsystem
Citation preview
Egor Elizarov SPbSU 20122
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!
Egor Elizarov SPbSU 20123
Lecture 6
Android IPC
Typical Android subsystem
yegor.yelizarov(at)gmail.com
http://vk.com/android_internalsRev: 1.1Last update: 06/01/2012
Egor Elizarov SPbSU 20124
Previous time
VM types
Virtualization approaches
Dalvik VM features
Interpreter core types
JIT algorithm
Android application start up process
Egor Elizarov SPbSU 20125
IPC Approaches
Classic
– System V IPC
– Posix IPC
Modern
– Binder
– Cross Memory Attach (CMA)
– KNEM
– Kdbus
Egor Elizarov SPbSU 20127
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
Egor Elizarov SPbSU 20128
Socket vs Binder
Socket
Associated with FD
Network transparency
Stream IO read/write
Binder
Associated with PID
Local only
Communication via IOCTL
Egor Elizarov SPbSU 201210
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
Egor Elizarov SPbSU 201218
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"));
Egor Elizarov SPbSU 201220
Middleware layer
Provide binder facilities to java framework
Marshalling/unmarshalling Parcels
Interaction with kernel
Managing threads
Egor Elizarov SPbSU 201224
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
Egor Elizarov SPbSU 201227
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
Egor Elizarov SPbSU 201228
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/AndroidNativeBinder
http://lwn.net/Articles/472984/
Egor Elizarov SPbSU 201229
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)