I have 3 process which have to send and receive data from each other. (Each process can send and receive)
I want to use share memory, but I have some questions about it:
Two processes can't write to same memory at the same time (and two process can't write and read memory at the same time) - it is not safe, so how can I protect this scenario (how can I lock the memory for read or write for a writing - reading operation and release the lock after it ?
2. when a process write data, how can the two other process can know that there is a new data to read from the memory ?
1. I know I need to use some sort of synchronization , but how to do it ?
2. Do I need to declare the semaphore (or other locker) in the share memory ?
3. How can the other processes can know if there is a new data available ? (instead of polling)
4. And how can Boost can help me ? (or it will be easier not to use Boost)