This article is based on the source code Scenario Analysis of the Android system, by Luo shengyang.
I ,~ /Android/frameworks/base/cmd/servicemanager
----- Binder. h
----- Binder. c
----- Service_manager.c
~ /Android // kernel/goldfish/drivers/staging/android
----- Binder. c
----- Binder. h
Ii. Source Code Analysis
1.
To understand the Android code, first understand the binder mechanism. The binder mechanism is also an elusive piece of Android, documenting the important concepts and implementations of binder as a memo. Part of the content from the Internet, if there is infringement, please timely inform.1.binder Communication Mechan
Forwarded from: http://blog.sina.com.cn/s/blog_4af327e10101irie.htmladvantages and disadvantages of D-busLinux does not have a good IPC mechanism. Windows, Mac OS, Android also has "binder" subsystem. Linux has sockets, FIFO, shared memory and other mechanisms, which are not very good for the application layer. Kdbus attempts to create a mechanism that is similar to other systems for Linux.D-bus is the closest approach to this standard on Linux. Pros:
4 Binder Protocol
The basic format of the Binder protocol is (command + data). The ioctl (fd, cmd, arg) function is used for interaction. The command is carried by the cmd parameter, and the data is carried by the arg parameter, which varies with the cmd parameter. The following table lists all commands and their corresponding data:
Table 2 Binder communication c
resource, other processes also access the resource. Therefore, it is primarily used as a means of synchronization between processes and between different threads within the same process.6. signal : Not for information exchange, more suitable for process interrupt control, such as illegal memory access, kill a process, etc.;The kernel of Android is also based on the Linux kernel, why not directly adopt the Linux existing process IPC program, is not the Linux community so many outstanding people
In Android, each application is made up of activity and service that are likely to run in the same process or run in different processes. So, how does the activity or service in the same process communicate? This is the binder interprocess communication mechanism to be described in this article.We know that the Android system is based on the Linux kernel, while the Linux kernel inherits and is compatible with the rich Unix system interprocess communic
In Android systems, each application is composed of multiple activity and service parts, and these activity and service are likely to be executed in the same processing, in addition, can also be performed in different processes.And then. How does activity or service communicate in the same process? This is the binder interprocess communication mechanism to be described in this article.We know that the Android system is based on the Linux kernel, while
We know that in Android, every application runs in a separate process, which also guarantees that when one of the programs has an exception, it does not affect the normal functioning of another application. In many cases, we work with the service of various systems, and it is clear that the program we write is definitely not the same process as the system service, but how do they communicate? Binder is one of the ways in which an inter-process communi
In the previous sections we introduced the principle and usage of native layer binder communication, so how to use binder communication in the Java layer. Its principle and native layer of binder have what relationship.
Similar to the native layer's ServiceManager, Android also has a servicemanager in the Java layer to process the registration and application of
What is a binder?
Binder is a type of IPC. Do not know IPC? Google, the omnipotent Google.In Linux, we know that resources are allocated and managed by processes. Processes run in independent spaces, which are closed and independent from each other. Then the problem arises. In a complicated operating system, what should we do if tasks need to be completed collaboratively between processes? This must inv
Many people are very interested in the reasons for trufun's existence: on the one hand, one of the competitors is the giant thing, the Big Mac IBM (the acquisition of rational), and the other is the development tool's super strong Borland (the acquisition of together ), coupled with open-source software (such as argouml) under the open-source wave, it is China's indifferent genuine awareness. If there is only the former, there is also a reason to survive, because, like the German Poseidon and th
Attribute Analysis
The biggest difference between Orange 2 skull King and Orange 0 is that the blood volume increases by 10000 and the attack increases by 800. Skull King of these attributes, in fact, is very poor, so do not recommend everyone to go up Orange 2.
Skill Analysis
"Flying Hammer" can stun targets, the damage can be neglected, the only role is to c
Binder is used to complete interprocess communication (IPC), that is, multiple processes are "not" together, from the thread point of view,thebinder driver code runs in the kernel state, the client program calls binders are done through system calls. Binder is an architecture that provides a server-side interface,binder driver, and client interface three module
RPC (IPC) in Android is implemented by the binder component. Although we use more aidl, we will not directly use binder, however, it can help you better understand aidl and the principles and mechanisms of Android.Binder Architecture
Similar to the architecture of other android components, the binder is also composed of Java-layer encapsulation, JNI, libbinder, a
This article is based on the source code Scenario Analysis of the Android system, by Luo shengyang.
I. Test code:
~ /Android/external/binder/server
---- FregServer. cpp
~ /Android/external/binder/common
---- IFregService. cpp
---- IFregService. h
~ /Android/external/binder/client
---- FregClient. cpp
Binder Library (l
This article is based on the source code Scenario Analysis of the Android system, by Luo shengyang
I. Test code:
~ /Android/external/binder/server
---- FregServer. cpp
~ /Android/external/binder/common
---- IFregService. cpp
---- IFregService. h
~ /Android/external/binder/client
---- FregClient. cpp
Binder Library (li
4.3 struct binder_transaction_data: send and receive data packet structure
This structure is the standard format for Binder to receive/send data packets. Each member is defined as follows:
Table 5 structure of Binder send and receive data packets: binder_transaction_data
Member
Description
Union {Size_t handle;Void * ptr;} Target;
This Member specifies the destination of the sent da
6. Binder memory ing and receiving cache zone management
For the time being, let's take a look at how data arrives at the receiving end from the sending end in the traditional IPC method? Generally, the sender stores the prepared data in the cache and calls the API to enter the kernel through system calls. The kernel service program allocates memory in the kernel space and copies data from the sender's cache to the kernel cache. When the receiver read
mechanism is not unique to Android, any operating system requires an IPC mechanism, such as Linux can be named pipes, shared main memory, semaphores, sockets, Message Queuing and other ways to implement the IPC mechanism, Android is based on the Linux kernel, But wirelessly's IPC mechanism is not exactly the same as Linux, such as the binder mechanism is a feature of the IPC in Android, this IPC mechanism does not exist in Linux. This blog will expla
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.