linux - 哪些IPC方法只能用于相关流程?

标签 linux ipc

我忽略了以下重要问题,直到我从 http://mywiki.wooledge.org/BashFAQ/027 看到

Two unrelated processes cannot use the arguments, the environment or stdin/stdout to communicate; some form of inter-process communication (IPC) is required.

希望我能对大局有一些清晰的认识。

哪些IPC方法只能用于相关进程,而不能用于无关进程?

哪些 IPC 方法可以不受此限制地使用?

主要关注 Linux。

最佳答案

唯一的“相关”进程是子进程。如果进程 A fork 进程 B,那么进程 A 可以连接进程 B 本身的标准输入和标准输出,以便它可以与进程 b 对话。这就是“系统”调用的工作方式。

否则你必须做他提到的事情(或共享内存或 unix 套接字)

关于linux - 哪些IPC方法只能用于相关流程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33381418/

相关文章:

java - 将 node.js 进程与 java/scala 代码连接起来的最快方法

linux - 将多行日志文件转换为 CSV

c++ - libpthread 和 libc 中的 undefined reference

linux - 在可运行的 jar 中停止子线程

c - setsockopt() 错误 : Numerical argument out of domain

c - 用于 IPC 的 Linux 环回 UDP 套接字

c++ - 将 GUI 附加到命令行工具

linux - Bash 是否有办法获得有关表达式评估的详细输出?

linux - Linux 中的共享内存(ipc)

c - 在 C 中使用 char 指针传递 int