Boost.Interprocess. Using shared memory

30 Views Asked by At

I am considering using shared memory from Boost.Interprocess library to communicate between parent & child processes (running on the same machine). The C++ library I am developing is to be used on Windows & Linux.

I read the docs and did some research online. Still I have questions:

  1. There are multiple parent processes running and creating child process. I can assume at least as many as there cores on the machine. Is there a limit by OS on how many shared memories may be created?

  2. The docs say that explicit remove call is required to "remove" shared memory from the system. It is not clear what happens if a process dies before it has a chance to call remove API, e.g. process terminates. I understand the shared memory will be there until kernel reboots or some file is explicitly deleted (if file-persisted). Given that the shared memory name is unique, the name is lost when process dies.

The questions apply to Win & Linux.

If I do use a fixed name for shared memory, not sure how all these independent processes will coordinate and access their specific data from a single shared memory. Especially that the shared memory size is fixed (if i understood correctly).

Thanks.

0

There are 0 best solutions below