Problem (in short): I use POSIX Shared Memory and currently only use POSIX semaphores, and I need to manage multiple readers, multiple authors. I need help regarding which variables / methods I can use to control access within the limitations described below. I found an approach that I want to implement, but I do not know what methodology I can use to implement it when using POSIX shared memory.
What i found is https://stackoverflow.com/a/2126161/2326322 ... This link has an algorithm that I would like to use, but I'm not sure how to implement it with shared memory. Am I somehow storing a class in shared memory? Here I need help, please. The reason I'm not sure is because a lot of my research indicates that shared memory for primitives is only in order to avoid problems with problems, and STL objects cannot be used.
Note: For all my multi-threaded I use C ++ 11. This shared memory will be completely separate executable programs using C ++ 11 std :: threads, from which any thread of any process / executable will want to access. I have avoided pthread Linux for any of my multi-threaded operations and will continue to do so (except that only its control variable is not the actual pThreads).
Solution options designed to
- Sharing should be available between 2+ processes that will run several C ++ 11 std :: thread, which they may wish to access. That is, Several writers (exclusive one at a time), while simultaneously providing several simultaneous readers when no author wants access.
- Do not use BOOST libraries. Ideally native C ++ 11 or linux built-in libraries, something that will work without the need to install abstract libraries.
- Do not use the actual pThread threads, but can use some kind of object from there that will work with C ++ 11 std :: thread.
- It can ideally cope with a process malfunction during operation. For instance. Using the POSIX semaphore, if the process fires when it has a semaphore, everything is screwed. Have I seen people using file locks?
Thank you in advance
source share