File tree Expand file tree Collapse file tree 5 files changed +12
-2
lines changed
OperatingSystem/AndroidKernal/Framework Expand file tree Collapse file tree 5 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -254,11 +254,21 @@ Android的四大组件,有时候不同的组件之间所在的进程是不一
254254
255255# #### 2 谈谈你对Binder的理解
256256
257- # ### 3 一次完整的ipc通信流程是怎样的
258-
257+ # #### 3 一次完整的ipc通信流程是怎样的
258+ ! [](./imgs/ipc.webp)
259259# #### 4 binder对象跨进程传递原理是怎么样的
260+ + Binder 跨进程传输是通过 Parcel 传输的,先通过 WriteStrongBinder 写到 Parcel 再通过 ReadStrongBinder 读取Parcel。
261+ + 在 Parcel 中存储的结构是 flat_binder_object 根据偏移量来确定保存的位置。然后 Binder 驱动通过读取 Parcel 中的 binder 实体对象 创建了 binder_node 结构,和 binder_ref 引用给到目标进程;
262+ + 目标进程通过 binder_ref 的 handle 创建了 BpBinder 再往上调用到 BinderProxy 再调用到业务层 Proxy
263+ ! [](./imgs/binder_trans.png)
260264
261265# #### 5 说一说binder的oneway机制
266+ + 非 oneway:调用方阻塞(休眠)
267+ ! [](./imgs/one_way_01.png)
268+
269+
270+ + oneway:调用方非阻塞(non-block)
271+ ! [](./imgs/one_way_02.png)
262272
263273# ### 第7章 线程通信相关问题
264274
You can’t perform that action at this time.
0 commit comments