I am currently developing a modular structure using shared memory in C and C ++. The goal is to have independent programs in both C and C ++, talk to each other through shared memory.
eg. one program is responsible for reading GPS and the other is responsible for processing data from several sensors.
The master program will start all subordinate programs (I am currently using it fp = popen(./slave1/slave1,"r");for this), and then create segments of shared memory that each subordinate can connect to. The idea that if the slave dies, it can be restored by the wizard and reconnected to the same shared memory segment.
Slaves can also be exchanged at runtime (for example, switching one GPS from another).
The problem is that I run the slave through popen and pass the shared memory identifier to the slave. Through the pipe, the follower transfers back the required size. After that, I want to redirect the slave channel to the terminal in order to display debug messages and not go through the master.
Suggestions are welcome, as well as other solutions to the problem. The key must have some form of communication before setting up shared memory.
source
share