hushicai / hushicai.github.io

Blog
https://hushicai.github.io
27 stars 1 forks source link

进程 #85

Open hushicai opened 4 years ago

hushicai commented 4 years ago

Linux 32位操作系统,进程的内存空间:

image

更详细的内存空间:

image

参考In-Memory Layout of a Program (Process)

hushicai commented 4 years ago

进程间通信

每个进程都有各自不同的用户地址空间,任何一个进程的全局变量在另一个进程中都不可见,进程之间要交换数据必须通过内核,在内核中开辟一块缓冲区,进程1把数据从用户空间拷到内核缓冲区,进程2再从内核缓冲区把数据读走,内核提供的这种机制称为进程间通信(IPC,Inter-Process Communication)。

image

参考https://www.jianshu.com/p/c1015f5ffa74