Android essentials summary
- Binder
Binder is android-specific inter-process communication mechanism and RPC mechanism.
Android does not use traditional system V IPC and does use binder, which is efficient and fast. In order to provide efficient IPC, binder driver was added in linux kernel. And for app, AIDL was provided and app developers can develop binder client and server easily without coding the marshalling/unmarshalling stuffs.
- ASHMEM
Asynchronous shared memory was added to android linux kernel. Compared to system V shared memory, ashmem releases kernel resources when nobody refers the shared memory and kernel can reclaim unpinned shared memory when memory runs low. When app shares large amount of data to other app or service such as surface data and image, passing data by using shared memory does not need to copy data and therefore shared memory outperforms other methods like socket.
- AIDL
AIDL(Android Interface Definition Language) is a kind of IDL specific to android. AIDL defines programming inteface for IPC and android SDK automatically generates codes that marshall, unmarshall data and calls binder driver.
- Bionic
Anroid bionic is based on BSD standard C libary and does not have full support of POSIX APIs and full pthreads. However, the bionic has been kept simple, fast and lightweight.
Dynamic memory allocator
POSIX incompatibility: no passwd, printf without %n
- ART Android Runtime
ART is an application runtime environment in android. ART replaced Dalvik and performs AOT (Ahead-of-time) compilation on installation. ART improves overall execution efficiency and power consumption. At the same time, ART brings faster execution of applications, improved memory allocation and garbage collection, new application debugging features, and more accurate profiling of applications.
- Zygote
Zygote is a daemon which launchs apps. Zygote is launched by init.rc and preloads vm machines and java classes. When zygote receives a request to launch app, it forks a process. The forked process has a clean VM with preloaded classes then it can avoid from loading VM and classes as well as initializing. As a result, app can be quickly launched.
- COW (Copy On Write)
COW is a memory management technique in kernel.
A new forked process has the same memory map with the parent process. With COW technique, memories of the parent process are shared with the child process and marked COW.
When any byte is modified in memory page, kernel intercepts and copies the memory page. This technique saves lots of memory because unwritable memory pages like code sections can be shared with many processes and many data may be unmodified or modified infrequently.
- Wakelock
Wakelock prevents host CPU from going to sleep mode. If no wakelocks are held, power manager will put device in sleep mode. Currently, in addition to CPU, wakelock prevents screen and keypad lights from turning off.
- ION memory allocator
Before ION memory allocator, each SoC vendor provided its own memory allocation method in its driver and it was mobile manufacturers' difficulties. So ION memory allocator was proposed and it provided unified memory management interface for ease of use. Additionally, it allows efficient sharing of memory between user process, kernel, and hardware devices.
Binder is android-specific inter-process communication mechanism and RPC mechanism.
Android does not use traditional system V IPC and does use binder, which is efficient and fast. In order to provide efficient IPC, binder driver was added in linux kernel. And for app, AIDL was provided and app developers can develop binder client and server easily without coding the marshalling/unmarshalling stuffs.
- ASHMEM
Asynchronous shared memory was added to android linux kernel. Compared to system V shared memory, ashmem releases kernel resources when nobody refers the shared memory and kernel can reclaim unpinned shared memory when memory runs low. When app shares large amount of data to other app or service such as surface data and image, passing data by using shared memory does not need to copy data and therefore shared memory outperforms other methods like socket.
- AIDL
AIDL(Android Interface Definition Language) is a kind of IDL specific to android. AIDL defines programming inteface for IPC and android SDK automatically generates codes that marshall, unmarshall data and calls binder driver.
- Bionic
Anroid bionic is based on BSD standard C libary and does not have full support of POSIX APIs and full pthreads. However, the bionic has been kept simple, fast and lightweight.
Dynamic memory allocator
POSIX incompatibility: no passwd, printf without %n
- ART Android Runtime
ART is an application runtime environment in android. ART replaced Dalvik and performs AOT (Ahead-of-time) compilation on installation. ART improves overall execution efficiency and power consumption. At the same time, ART brings faster execution of applications, improved memory allocation and garbage collection, new application debugging features, and more accurate profiling of applications.
- Zygote
Zygote is a daemon which launchs apps. Zygote is launched by init.rc and preloads vm machines and java classes. When zygote receives a request to launch app, it forks a process. The forked process has a clean VM with preloaded classes then it can avoid from loading VM and classes as well as initializing. As a result, app can be quickly launched.
- COW (Copy On Write)
COW is a memory management technique in kernel.
A new forked process has the same memory map with the parent process. With COW technique, memories of the parent process are shared with the child process and marked COW.
When any byte is modified in memory page, kernel intercepts and copies the memory page. This technique saves lots of memory because unwritable memory pages like code sections can be shared with many processes and many data may be unmodified or modified infrequently.
- Wakelock
Wakelock prevents host CPU from going to sleep mode. If no wakelocks are held, power manager will put device in sleep mode. Currently, in addition to CPU, wakelock prevents screen and keypad lights from turning off.
- ION memory allocator
Before ION memory allocator, each SoC vendor provided its own memory allocation method in its driver and it was mobile manufacturers' difficulties. So ION memory allocator was proposed and it provided unified memory management interface for ease of use. Additionally, it allows efficient sharing of memory between user process, kernel, and hardware devices.
댓글
댓글 쓰기