Android: What is Binder Thread?

后端 未结 3 1740
孤城傲影
孤城傲影 2020-12-24 08:27

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
<
3条回答
  •  轮回少年
    2020-12-24 08:45

    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.

提交回复
热议问题