Android Inter-process communication

Source: Internet
Author: User

I. What are the methods of inter-process communication between Linux systems?

1.socket;

2.name pipe Named Pipes;

3.message queue Message Queuing;

4.singal signal volume;

5.share memory sharing;

Two. What is the way the Java system communicates?

1.socket;

2.name pipe;

Three. What is the mode of communication between Android systems?

Binder communication;

Four. What are the advantages of binder communication?

High efficiency

Five. What are the characteristics of binder communication?

Is synchronous, not asynchronous;

Six. How is binder communication implemented?

1.Binder communication is achieved through the binder driver of Linux,

2.Binder communication operations like thread migration (threadmigration), two interprocess IPC looks like a process entering another process executing code and returning with the result of execution;

The 3.Binder user space maintains an available thread pool for each process, and the thread pool is used to process incoming IPC and execute process local messages, and binder communication is synchronous rather than asynchronous.

Seven. Key to Binder communication in Android:

1. Binder Communication in Android is based on service and client working model;

2. All processes that require ibinder communication must create a IBinder interface;

3. There is one process in the system that manages all system service:

4. Android does not allow users to add non-authorized systemservice;

5. Now the source is open, we can modify some code to achieve the purpose of adding the underlying system service;

6. For the user program, we also want to create the server, or service for interprocess communication;

7. Activitymanagerservice manages all service creation and connection (connect) of Java application layer, disconnect;

8. All activity is also initiated and loaded through this service;

9. Activitymanagerservice is also loaded in the systems Servcie;

Eight. Android's service workflow

The service manager process starts before the 1.Android virtual machine starts, the 2.service manager opens the binder driver and notifies the binder kernel driver that the process will act as the system service Manager;

3. The process then enters a loop and waits for data from other processes to be processed. 4. After a user creates a system service, a remote ServiceManager interface is obtained via Defaultservicemanager, which allows us to call the AddService function to set the system Service is added to the service manager process;

5. The client can then obtain the IBinder object for the service that needs to be connected through GetService, which is a reference to the bbinder of the service in Binder kernel,

6. So Serviceibinder does not have the same two IBinder objects in binder kernel, and each client process also needs to open the binder driver. For the user program, we get this object to access the methods in the service object through Binderkernel.

7.Client and service in different processes, in this way to achieve a similar thread of the migration of communication mode, for the user program when the service returned to the IBinder interface, access to the service in the method is like calling its own function.

Android Inter-process communication

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.