Basic knowledge of the Linux kernel:
- process isolation/virtual address space : In the operating system, in order to protect a process from interfering with each other, a technology called "process isolation" is designed to prevent process A from manipulating process B's data. While the process isolation technology uses the virtual address space, the virtual address space of process A is different from the virtual address space of process B, and if notification between process and process requires some kind of communication mechanism, it is the binder communication mechanism in Android.
- system call : Because the system has some kind of protection mechanism to tell the application that you can only access certain licensed resources, the unauthorized resources cannot be accessed, that is, the kernel layer of Linux is abstracted from the application layer, that is, the kernel layer and the user space, Users can use universal system calls to access some of the kernel's programs in user space.
- Binder Driver : In the Android system it is running in kernel space, it is responsible for each user process through the binder communication of the kernel to interact with a module is Binder driver. It can be used to access the hardware.
Binder Communication Mechanism Introduction:
- Why use binder?
A, Android uses the Linux kernel has a lot of cross-process communication mechanisms, such as: pipelines, sockets, and so on, then why does Android have to deliberately engage a binder communication mechanism? The main point is the following two points of consideration:
B, Performance: Mobile devices If the widespread use of cross-process communication mechanisms will certainly be strict requirements for communication mechanisms, and binder compared to the traditional process of communication more efficient.
C, Security: Because the traditional process of communication does not have to the two sides of the communication and the body to make strict verification, only the upper layer protocol will go to the architecture, such as the socket connection IP address can be artificially forged. The binder identity check is also the basis for Android permission mode.
- Binder Communication mode:
A, telephone base station: Binder Drive
b, the communication record: ServiceManager
Here is an example of a comparative image to illustrate the above communication and telephone base station in the binder communication model of the role: a classmate to call the B classmate, first a reunion to find B classmate's phone number, and ServiceManager driver's role is equivalent to the address book, There are some similar phone numbers on both sides of the communication can identify the other side of the east, but find the phone number to get through each other, also need to support the telephone base station, the telephone base station is used to transmit the signals of both sides, so binder drive is equivalent to the telephone base station. Here is a diagram to illustrate:
Aidl:
Android Basic related interview Questions-binder interview questions detailed