【发布时间】:2020-09-29 12:43:03
【问题描述】:
来自shm_unlink的手册页:
The operation of shm_unlink() is analogous to unlink(2): it removes a
memory object name, and, once all processes have unmapped the object,
de-allocates and destroys the contents of the associated memory
region. After a successful shm_unlink(), attempts to shm_open()
an object with the same name fail (unless O_CREAT was specified,
in which case a new, distinct object is created).
这句话的作用是由句子指定的
it removes a memory object name, and, once all processes have unmapped the object, de-allocates and destroys the contents of the associated region
那么,这是否意味着当调用shm_unlink 时,将自动对所有进程进行取消映射,然后销毁将发生,或者它仍然存在,并且只要使用此空间的所有进程都取消映射空间(根据他们未来的方便),它会被破坏吗?
上面的描述是手册页的描述有点不足,这可以用上述两种方式解释,因此我怀疑。
【问题讨论】:
-
进程不会把地毯从脚下拉出来。
-
@IanAbbott 所以在所有进程都取消映射它之后,只有它会被取消分配,对吧?
标签: linux posix shared-memory