在两个进程之间共享内存 [英] Sharing memory between two processes
本文介绍了在两个进程之间共享内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在两个进程之间共享内存.我知道的一种方法是mmap
共享文件.但是,我不想使用共享文件,而是要在内存中使用匿名映射.我该怎么办.
I want to share memory between two processes. One way I know is to mmap
a shared file. However, I don't want to use a shared file, I want an anonymous mapping in the memory. How can I do that.
推荐答案
shm_open 是您的朋友.您可以使用 shm_unlink 取消映射共享区域.
shm_open is your friend. You can unmap the shared region by using shm_unlink.
这篇关于在两个进程之间共享内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文