简体   繁体   English

升压共享 memory。 当前有多少进程在使用共享 memory?

[英]Boost shared memory. How many processes are currently using the shared memory?

I am sharing some memory between processes, using the boost library;我正在使用 boost 库在进程之间共享一些 memory;

boost::interprocess::managed_shared_memory managed_shm(boost::interprocess::open_or_create, "shm", 1024); boost::interprocess::managed_shared_memory managed_shm(boost::interprocess::open_or_create, "shm", 1024);

is there a way to find out how many processes are currently accessing this memory?有没有办法找出当前有多少进程正在访问这个 memory?

If you can get the underlying SHM ID, you can use shmctl function to get the number of processes having the segment attached.如果您可以获取底层 SHM ID,则可以使用 shmctl function 来获取附加了该段的进程数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM