Qt_Qtopia与Android的进程间通讯方式


___________________________________________________________________________________________________________________________
| 平台  | 进程间通讯方式  |   简介                                                                                         |
|-------------------------|------------------------------------------------------------------------------------------------|
|Linux  |1.管道(半双工)   |它们是半双工的。数据只能在一个方向上流动它们只能在具有公共祖先的进程之间使用.                   |
|       |                 |通常,一个管道由一个进程创建,然后该进程调用f o r k,此后父、子进程之间就可应用该管道.          |
|       |                 |由调用pipe函数而创建.                                                                           |
|       |                 |                                                                                                |
|       |2.FIFOs(命名管道)|FIFO是一种文件类型.由调用mkfifo函数而创建.                                                      |
|       |                 |                                                                                                |
|       |3.流管道(全双工) |单个流管道能向父、子进程提供双向的数据流.s _ p i p e函数.                                       |
|       |                 |                                                                                                |
|       |4.消息队列       |消息队列是消息的链接表,存放在内核中并由消息队列标识符标识.m s q i d _ d s结构,msgctl函数.       |
|       |                 |                                                                                                |
|       |5.信号量         |它是一个计数器,用于多进程对共享数据对象的存取. semid_ds结构.                                   |
|       |                 |                                                                                                |
|       |6.共享内存       |共享存储允许两个或多个进程共享一给定的存储区.                                                   |
|       |                 |因为数据不需要在客户机和服务器之间复制,所以这是最快的一种I P C.                                |
                          |通常,信号量被用来实现对共享存储存取的同步.s h m i d _ d s结构,shm系列函数.                    |
|       |                 |                                                                                                |
|       |7.套接口(socket) |主要用于客户机/服务器之间的通讯.socket系列函数.                                                 |
|-------|-----------------|------------------------------------------------------------------------------------------------|
|       |                 |                                                                                                |
|QT/    |1.信号/槽机制    |由于整个框架包括应用都是直接基于Linux用C++开发的,所以,理论上讲,Linux中的进程间通讯方式在QT/     |
|Qtopia |2.共享内存类     |Qtopia平台完全可以采用.除此之外,QT/Qtopia还提供了自己的共享内存类,以及独特的信号/槽机制.        |
|-------|-----------------|------------------------------------------------------------------------------------------------|
|       |                 |                                                                                                |
|Android|1.binder         |Android的App层都旭java代码,只能由JVM来解释,所以,对于Android,进程间的通信依赖于Framework,    |
|       |                 |更确切地说,是依赖于JVM,而不能直接调用Linux的系统调用的进程间通讯方式。                        |
|       |                 |Android提供了独有的binder机制来实现进程间的通信.Binder机制底层也是通过实现共享内存来提供接口的, |
|       |                 |只是并不是调用shm系列函数,而是通过申请内存空间,以及ioctrl来进行封装的。                       |
|       |                 |而对于上层来说,整个架构类似于com.由于com已经广泛应用于各个平台和领域,                         |
|       |                 |所以,建议读者看一看这方面的资料和书籍,然后再来理解binder机制,就更加明白了。                  |
|       |                 |你会发现,IInterface,stub这些术语和概念在这两个框架中的异曲同功之妙。                            |
                                                                                                                           |
___________________________________________________________________________________________________________________________

 

你可能感兴趣的:(android,linux,服务器,存储,qt,通讯)