Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: What is Binder Thread?

Tags:

I use Debug.startMethodTracing for my purposes and in the output file I can see(I don't use IPC):

8   Binder Thread #2 7   Binder Thread #1 

For what it is?

like image 407
pvllnspk Avatar asked Mar 05 '13 10:03

pvllnspk


People also ask

Why binder is used in Android?

Binder IPC Framework in Android Framework enables a remote invocation of the methods in other processes. A client process communicate to another server process and can run the methods in other process as it is done locally and can get the required data from the server process.

What are the main two types of threads in Android?

There're 3 types of thread: Main thread, UI thread and Worker thread. Main thread: when an application is launched, the system creates a thread of execution for the application, called main.

What are Android threads?

A thread is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently. Every thread has a priority. Threads with higher priority are executed in preference to threads with lower priority.

What is a Binder object?

Binder is an Android-specific interprocess communication mechanism, and remote method invocation system. That is, one Android process can call a routine in another Android process, using binder to indentify the method to invoke and pass the arguments between processes.


1 Answers

Binder thread represents a separate thread of your service. Binder is a mechanism that provides Inter Process Communication.

Let's consider an example. Imagine that you have service Process B (see picture). And you have several applications that communicate with this service B (one of this application is, for instance, Process A). Thus, one service B should provide different results simultaneously to different applications. Thus, you need to run several replicas of Service B for different applications. Android runs these replicas in different threads of the Process B and these threads are called "Binder Thread #N".

Binder communication

I took the picture here, where you can also read what Binder is.

like image 135
Yury Avatar answered Feb 17 '23 02:02

Yury