问题描述
我正在使用 shmget
, shmat
和 shmctl
分别获取和创建共享内存段,将其附加在进程地址空间中并删除它.
I am using shmget
, shmat
and shmctl
to respectively get and create a shared memory segment, attach it in processes address space and remove it.
我想知道即使已分离共享内存段并要求使用删除共享内存段,进程是否仍可以使用共享内存段
I am wondering if processes can still use the shared memory segment even if it has been detached and asked for removal using
shmctl(id, IPC_RMID, ...)
在一个过程中.
我无法从手册页中获取信息:
I am not able to get the information from the man page:
推荐答案
在 Linux 上,即使共享内存段已经被标记为删除,也可以附加它.但是,POSIX.1-2001没有指定此行为,并且许多其他实现也不支持此行为.
On Linux, it is possible to attach a shared memory segment even if it is already marked to be deleted. However, POSIX.1-2001 does not specify this behavior and many other implementations do not support it.
这篇关于彻底销毁System V共享内存段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!