Skip to main content

进程间通信

进程间通信IPCInter-Process Communication),指至少两个进程线程间传送数据或信号的一些技术或方法。进程是计算机系统分配资源的最小单位(严格说来是线程)。每个进程都有自己的一部分独立的系统资源,彼此是隔离的。为了能使不同的进程互相访问资源并进行协调工作,才有了进程间通信。这些进程可以运行在同一计算机上或网络连接的不同计算机上。
进程间通信技术包括消息传递、同步、共享内存和远程过程调用。IPC是一种标准的Unix通信机制。
使用IPC 的理由:
  • 信息共享
  • 加速;
  • 模块化;
  • 方便; 以及
  • 私有权分离.
与直接共享内存地址空间的多线程编程相比,IPC的缺点:[1]
  • 采用了某种形式的内核开销,降低了性能;
  • 几乎大部分IPC都不是程序设计的自然扩展,往往戏剧性增加了程序复杂度。

主要的 IPC 方法

方法 提供方(操作系统或其他环境)
文件 多数操作系统
信号 多数操作系统
Berkeley套接字 多数操作系统
消息队列 多数操作系统
管道 所有的 POSIX 系统, Windows.
命名管道 所有的 POSIX 系统, Windows.
信号量 所有的 POSIX 系统, Windows.
共享内存 所有的 POSIX 系统, Windows.
Message passing
(不共享)
用于 MPI规范,Java RMI, CORBA, MSMQ, MailSlot 以及其他.
Memory-mapped file 所有的 POSIX 系统, Windows.

实现

下列方式只适用于特定操作系统平台或特定的编程语言:

其他

有人认为这些也可以算是进程间通信的方式:
http://gengwg.blogspot.com/

Comments

Popular posts from this blog

CKA Simulator Kubernetes 1.22

  https://killer.sh Pre Setup Once you've gained access to your terminal it might be wise to spend ~1 minute to setup your environment. You could set these: alias k = kubectl                         # will already be pre-configured export do = "--dry-run=client -o yaml"     # k get pod x $do export now = "--force --grace-period 0"   # k delete pod x $now Vim To make vim use 2 spaces for a tab edit ~/.vimrc to contain: set tabstop=2 set expandtab set shiftwidth=2 More setup suggestions are in the tips section .     Question 1 | Contexts Task weight: 1%   You have access to multiple clusters from your main terminal through kubectl contexts. Write all those context names into /opt/course/1/contexts . Next write a command to display the current context into /opt/course/1/context_default_kubectl.sh , the command should use kubectl . Finally write a second command doing the same thing into ...

OWASP Top 10 Threats and Mitigations Exam - Single Select

Last updated 4 Aug 11 Course Title: OWASP Top 10 Threats and Mitigation Exam Questions - Single Select 1) Which of the following consequences is most likely to occur due to an injection attack? Spoofing Cross-site request forgery Denial of service   Correct Insecure direct object references 2) Your application is created using a language that does not support a clear distinction between code and data. Which vulnerability is most likely to occur in your application? Injection   Correct Insecure direct object references Failure to restrict URL access Insufficient transport layer protection 3) Which of the following scenarios is most likely to cause an injection attack? Unvalidated input is embedded in an instruction stream.   Correct Unvalidated input can be distinguished from valid instructions. A Web application does not validate a client’s access to a resource. A Web action performs an operation on behalf of the user without checkin...