RPC和IPC的区别

来源:互联网 发布:zoom视频会议软件下载 编辑:程序博客网 时间:2024/05/22 02:17

 

RPC:

 http://en.wikipedia.org/wiki/Remote_procedure_call

 In computer science, a remote procedure call (RPC) is an inter-process communication that allows a computer program to cause a subroutineor procedure to execute in another address space (commonly on another computer on a shared network) without the programmer explicitly coding the details for this remote interaction. That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote. When the software in question uses object-oriented principles, RPC is called remote invocation or remote method invocation.

 

 

IPC: http://en.wikipedia.org/wiki/Inter-process_communication

In computing, inter-process communication (IPC) is a set of methods for the exchange of data among multiple threads in one or moreprocesses. Processes may be running on one or more computers connected by a network. IPC methods are divided into methods for message passing, synchronization, shared memory, and remote procedure calls (RPC). The method of IPC used may vary based on the bandwidth and latency of communication between the threads, and the type of data being communicated.

There are several reasons for providing an environment that allows process cooperation:

  • Information sharing
  • Computational speedup
  • Modularity
  • Convenience
  • Privilege separation

IPC may also be referred to as inter-thread communication and inter-application communication.

 

可见,RPC是IPC的一种。


RMI和RPC之间最主要的区别在于方法是如何别调用的。在RMI中,远程接口使每个远程方法都具有方法签名。如果一个方法在服务器上执行,但是没有相匹配的签名被添加到这个远程接口上,那么这个新方法就不能被RMI客户方所调用。在RPC中,当一个请求到达RPC服务器时,这个请求就包含了一个参数集和一个文本值,通常形成“classname.methodname”的形式。这就向RPC服务器表明,被请求的方法在为“classname”的类中,名叫“methodname”。然后RPC服务器就去搜索与之相匹配的类和方法,并把它作为那种方法参数类型的输入。这里的参数类型是与RPC请求中的类型是匹配的。一旦匹配成功,这个方法就被调用了,其结果被编码后返回客户方。

原创粉丝点击