RPC 和 IPC 有区别吗?

发布于 2024-08-19 05:58:56 字数 17 浏览 2 评论 0原文

或者它们是同义词吗?

Or are they synonyms?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

私野 2024-08-26 05:58:56

维基百科通常非常适合这些目的。

远程过程调用:

远程过程调用(RPC)是一种
进程间通信技术
允许计算机程序
导致子例程或过程
在另一个地址空间执行
(通常在另一台计算机上
共享网络)无需程序员
为此明确编码细节
远程交互。

工控机:

进程间通信(IPC)是一种
一套用于交换的技术
一个或多个线程之间的数据
更多流程。流程可能是
在一台或多台计算机上运行
通过网络连接。

所以,RPC只是IPC的一种。

Wikipedia is usually great for these purposes.

RPC:

Remote procedure call (RPC) is an
Inter-process communication technology
that allows a computer program to
cause a subroutine or 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.

IPC:

Inter-process communication (IPC) is a
set of techniques for the exchange of
data among multiple threads in one or
more processes. Processes may be
running on one or more computers
connected by a network.

So, RPC is just one kind of IPC.

ぃ双果 2024-08-26 05:58:56

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

天邊彩虹 2024-08-26 05:58:56

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.

剩一世无双 2024-08-26 05:58:56

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..

∞梦里开花 2024-08-26 05:58:56
  • 远程过程调用(调用
    系统中的远程方法)
  • 进程间通信(方法
    启用同一系统中的进程
    进行交互)。
  • Remote Procedure Call (calling
    methods remotely at a system)
  • Interprocess Communication (method
    enabling processes in the same system
    to interact).
陌上芳菲 2024-08-26 05:58:56

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

A君 2024-08-26 05:58:56

要回答您的问题,最好充分了解 IPC 和 RPC 到底是什么、它们如何工作以及它们具有哪些属性,以便我们可以更好地发现它们之间的差异(如果有)。
在我的回答中,我将引用一本书,书名是:“操作系统概念,第 10 版”,由 Avi Silberschatz、Peter Baer Galvin 和 Greg Gagne 撰写,由 John Wiley & 出版社出版。 Sons Inc.,有关本书的更多信息此处

IPC

< strong>为什么以及何时应该使用IPC?

进程有两种类型:独立进程和协作进程。顾名思义,独立进程与其他进程没有任何交互。但另一方面,协作进程需要与其他进程进行通信和交互,这就是 IPC 的用武之地,正如我们在本书第 123 页第 3.4 节中读到的那样:

协作进程需要进程间通信 (IPC) 机制来允许它们交换数据,即相互发送数据和接收数据。进程间通信有两种基本模型:共享内存和消息传递。

正如书中提到的,有两种类型的沟通。 共享内存消息传递
用于 RPC 的模型通常基于后者,因此为了能够更好地比较两者(IPC 和 RPC),我假设两者都使用消息传递方案。
那么什么是消息传递以及它在 IPC 中如何工作?
该书第 128 页第 3.6 节指出:

消息传递提供了一种机制,允许进程进行通信并同步其操作,而无需共享相同的地址空间。它在分布式环境中特别有用,在分布式环境中,通信进程可能驻留在通过网络连接的不同计算机上。

还有:

有几种方法可以逻辑地实现链接:

  • 直接或间接沟通
  • 同步或异步通信
  • 自动或显式缓冲

因此,我们应该考虑尝试通过消息传递相互通信的进程可以位于相同的进程中,也可以位于单独的进程中。机器(并且在同一网络上)。
正如 @vrnithinkumar 在答案中提到的那样,还有许多方法可以在使用消息传递进行通信的进程之间建立(逻辑上)链接,书中也建议了这一点。但无论哪种方式,都要考虑的一点是,进程本身是主要涉及发送和接收消息的进程,或者在这里看起来是这样。当然,操作系统(或任何其他介质)可以提供这种通信的手段并能够控制它,但是,为此目的并没有引入太多接口。

RPC

到底什么是 RPC RPC 何时使用以及如何操作?
本书将 RPC 定义为:

通过网络发送并在另一台计算机上执行的过程调用;常用于客户端-服务器计算。

此外,第 3.8.2 节

远程服务最常见的形式之一是 RPC 范例,它被设计为一种抽象过程调用机制的方法,以便在具有网络连接的系统之间使用。它在很多方面与 IPC 机制相似,并且通常构建在这样的系统之上。

书中提到了 IPC 和 RPC 之间的一个特殊区别:

与 IPC 消息相比,RPC 通信中交换的消息结构良好,因此不再只是数据包。每条消息都发送到侦听远程系统上端口的 RPC 守护程序,并且每条消息都包含一个标识符,指定要执行的函数以及要传递给该函数的参数。然后,该函数将按照请求执行,并且任何输出都会通过单独的消息发送回请求者。

在 RPC 中,使用一种称为存根的东西来完成系统中发送/接收消息的一些繁重工作。
这本书在第 150 页解释了存根:

RPC 系统通过在客户端提供存根来隐藏允许进行通信的详细信息。通常,每个单独的远程过程都存在一个单独的存根。当客户端调用远程过程时,RPC 系统调用适当的存根,并将提供给远程过程的参数传递给它。该存根定位服务器上的端口并封送参数。然后存根使用消息传递将消息传输到服务器。服务器端的类似存根接收此消息并调用服务器上的过程。如有必要,返回值将使用相同的技术传递回客户端。

这里要考虑的另一件事是存根的运行方式,它为系统提供了某种程度的封装。

结论

现在我们对 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:

Cooperating processes require an interprocess communication (IPC) mechanism that will allow them to exchange data— that is, send data to and receive data from each other. There are two fundamental models of interprocess communication: shared memory and message passing.

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:

Message passing provides a mechanism to allow processes to communicate and to synchronize their actions without sharing the same address space. It is particularly useful in a distributed environment, where the communicating processes may reside on different computers connected by a network.

and also:

There are several methods to logically implement a link:

  • Direct or indirect communication
  • Synchronous or asynchronous communication
  • Automatic or explicit buffering

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:

Procedure calls sent across a network to execute on another computer; commonly used in client-server computing.

furthermore in section 3.8.2:

One of the most common forms of remote service is the RPC paradigm, which was designed as a way to abstract the procedure-call mechanism for use between systems with network connections. It is similar in many respects to the IPC mechanism and it is usually built on top of such a system.

here then the book mentions a particular difference between IPC and RPC(s):

In contrast to IPC messages, the messages exchanged in RPC communication are well structured and are thus no longer just packets of data. Each message is addressed to an RPC daemon listening to a port on the remote system, and each contains an identifier specifying the function to execute and the parameters to pass to that function. The function is then executed as requested, and any output is sent back to the requester in a separate message.

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:

The RPC system hides the details that allow communication to take place by providing a stub on the client side. Typically, a separate stub exists for each separate remote procedure. When the client invokes a remote procedure, the RPC system calls the appropriate stub, passing it the parameters provided to the remote procedure. This stub locates the port on the server and marshals the parameters. The stub then transmits a message to the server using message passing. A similar stub on the server side receives this message and invokes the procedure on the server. If necessary, return values are passed back to the client using the same technique.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文