RPC 和 IPC 有区别吗?
或者它们是同义词吗?
Or are they synonyms?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
或者它们是同义词吗?
Or are they synonyms?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
维基百科通常非常适合这些目的。
远程过程调用:
工控机:
所以,RPC只是IPC的一种。
Wikipedia is usually great for these purposes.
RPC:
IPC:
So, RPC is just one kind of IPC.
RPC - 远程过程调用 - 是一种特殊类型的通信,但可以在单台计算机上进行,也可以在计算机之间通过网络进行。
http://en.wikipedia.org/wiki/Remote_procedure_call
IPC - 进程间通信 - 是不同进程(通常在一台机器上)之间通信的通用术语。
http://en.wikipedia.org/wiki/Inter-process_communication
RPC - Remote Procedure Call - is a particular type of communication, but can be on a single machine, or across a network between machines.
http://en.wikipedia.org/wiki/Remote_procedure_call
IPC - Inter-Process Communication - is a general term for communication between different processes (which are usually on a single machine).
http://en.wikipedia.org/wiki/Inter-process_communication
RPC(远程过程调用)是 IPC(进程间通信)的一种形式 - 后者是一个更通用的术语,涵盖了除 RPC 之外的许多机制。
An RPC (remote procedure call) is a form of IPC (interprocess communication) - the latter is a more general term, covering lots of mechanisms besides RPCs.
IPC是一组与同一台计算机或不同计算机上的两个进程进行通信的方法。它包括直接通信和直接通信。间接通讯、同步通讯异步通信和显式缓冲。
但 RPC 是一种从服务器到客户端调用过程并以消息形式返回其结果的方法。
IPC is a set of method to communicate with two process which may be in same computer or different computer.it includes direct & indirect communication,synchronous & asynchronous communication and explicit buffering.
But RPC is a method to call a procedure from sever to client and get back its result as message..
系统中的远程方法)
启用同一系统中的进程
进行交互)。
methods remotely at a system)
enabling processes in the same system
to interact).
RPC = IPC + 服务器位置、编组、网络故障、延迟 - 特殊复制技巧、速度
有关更多详细信息:-
https://www.cs.cmu.edu/~410- f03/lectures/L31_IPCRRPC.pdf
RPC = IPC + server location, marshalling, network failure, delays - special copy tricks, speed
For further detail:-
https://www.cs.cmu.edu/~410-f03/lectures/L31_IPCRPC.pdf
要回答您的问题,最好充分了解 IPC 和 RPC 到底是什么、它们如何工作以及它们具有哪些属性,以便我们可以更好地发现它们之间的差异(如果有)。
在我的回答中,我将引用一本书,书名是:“操作系统概念,第 10 版”,由 Avi Silberschatz、Peter Baer Galvin 和 Greg Gagne 撰写,由 John Wiley & 出版社出版。 Sons Inc.,有关本书的更多信息此处。
IPC
< strong>为什么以及何时应该使用IPC?
进程有两种类型:独立进程和协作进程。顾名思义,独立进程与其他进程没有任何交互。但另一方面,协作进程需要与其他进程进行通信和交互,这就是 IPC 的用武之地,正如我们在本书第 123 页第 3.4 节中读到的那样:
正如书中提到的,有两种类型的沟通。 共享内存和消息传递。
用于 RPC 的模型通常基于后者,因此为了能够更好地比较两者(IPC 和 RPC),我假设两者都使用消息传递方案。
那么什么是消息传递以及它在 IPC 中如何工作?
该书第 128 页第 3.6 节指出:
还有:
因此,我们应该考虑尝试通过消息传递相互通信的进程可以位于相同的进程中,也可以位于单独的进程中。机器(并且在同一网络上)。
正如 @vrnithinkumar 在答案中提到的那样,还有许多方法可以在使用消息传递进行通信的进程之间建立(逻辑上)链接,书中也建议了这一点。但无论哪种方式,都要考虑的一点是,进程本身是主要涉及发送和接收消息的进程,或者在这里看起来是这样。当然,操作系统(或任何其他介质)可以提供这种通信的手段并能够控制它,但是,为此目的并没有引入太多接口。
RPC
到底什么是 RPC RPC 何时使用以及如何操作?
本书将 RPC 定义为:
此外,第 3.8.2 节:
书中提到了 IPC 和 RPC 之间的一个特殊区别:
在 RPC 中,使用一种称为存根的东西来完成系统中发送/接收消息的一些繁重工作。
这本书在第 150 页解释了存根:
这里要考虑的另一件事是存根的运行方式,它为系统提供了某种程度的封装。
结论
现在我们对 RPC 和 IPC 有了更好的了解,让我们回答以下问题:
RPC 和 IPC 之间有区别吗?
是的,有。RPC 和 IPC 之间有什么区别?
一般来说,RPC 的目的只是为调用者调用一个函数(过程),并返回一条包含调用该函数结果的消息。然而,IPC 的目的仅仅是在与通信相关的进程之间交换数据。即使在 RPC 用作 IPC 形式的情况下,例如 Android Binder 框架,我们可以说该模型建议强调封装和接口(这里使用 RPC 这个词),用于进程通信。或者简单地说,它以 RPC 方式进行 IPC(或者可以说反之亦然)。RPC 和 IPC 是同义词吗?
尽管它们有许多相似之处和属性,但技术上的答案是:不是。To answer your question, it's better to get a good grasp on what IPC and RPC(s) exactly are, how they work, and what properties they have, so we could better spot their differences if there are any.
I'm going to refer to a book throughout my answer by the title of: "Operating System Concepts, 10th edition", written by Avi Silberschatz, Peter Baer Galvin, and Greg Gagne and published by John Wiley & Sons Inc., more information about the book here.
IPC
Why and when should we use IPC?
There are two types of processes: independent processes and cooperating processes. independent processes don't have any interactions with other processes as their name suggests. But on the other hand, a cooperating process needs to have communication and interaction with other processes, that's when IPC comes in, as we read in section 3.4, page 123 of the book:
There are two types of communication as the book mentioned. shared memory and message-passing.
The model used for an RPC is often based on the latter, so to be able to better compare the two (IPC and RPC), I'd assume that both are using a message-passing scheme.
So what is message-passing and how does it work in IPC?
section 3.6, page 128 of the book states:
and also:
Therefore, we should consider that processes that are trying to communicate with each other via message-passing can either be in the same or a separate machine (and on the same network).
There are also, many ways in which a link (logically) could be established between processes that are communicating using message-passing as @vrnithinkumar mentioned in the answers and the book also suggests. but one point to consider either way, is that the processes themselves are the ones that are mainly involved in sending and receiving messages, or here it may seem as such. Sure, OS (or any other medium) could provide the means for such communication and be able to control it, still, not much of an interface was introduced for the purpose on this side.
RPC
What exactly is an RPC and when is it used and how does it operate?
The book defines RPC(s) as:
furthermore in section 3.8.2:
here then the book mentions a particular difference between IPC and RPC(s):
In RPCs something called a stub is used which does some of the heavy lifting for sending/receiving messages in the system.
the book explains stubs on page 150:
Another thing to consider here is the way that a stub operates, which provides the system with some degree of encapsulation.
Conclusion
So now that we have a better understanding of RPC and IPC, let's answer these questions:
Is there a difference between RPC and IPC?
Yes, there is.What are the differences between RPC and IPC?
Generally, the purpose of RPC is simply to call a function (procedure) for the caller and to return a message containing the result of calling that function. However, the purpose of IPC is solely to exchange data between the processes associated with communication. Even in cases where RPC is used as a form of IPC, like the Android binder framework, we could say that the model suggests an emphasize towards encapsulation and the interface (by utilizing the word RPC here), used for the process communication. Or to simply put it, it does IPC in the RPC way (or arguably vice-versa).Are RPC and IPC synonyms?
Although they have many similarities and properties, a technical answer would be, no.