title: Starting programs from C++, exchanging info with pipes and then shared memory
body: <p>I am currently developing a modular framework using shared memory in C &amp; C++.
  The goal is to have independent programs in both C and C++, talk to each other through shared memory.</p>
  
  <p>E.g. one program is responsible for reading a GPS and another responsible for processing the data from several sensors.  </p>
  
  <p>A master program will start all the slave programs 
  (currently i am using <code>fp = popen(./slave1/slave1,"r");</code> to do this) and then make shared memory segments that each slave can connect to. 
  The thought behind this is that if a slave dies, it can be revived by the master and reconnect to the same shared memory segment.<br>
  Slaves can also be exchanged during runtime (e.g. switch one GPS with another).</p>
  
  <p>The problem is that I spawn the slave via popen, and pass the shared memory ID to the slave. Via the pipe the slave transmits back the size needed.
  After this is done i want to reroute the slave's pipe to terminal to display debug messages and not pass through the master.</p>
  
  <p>Suggestions are greatly appreciated, as well as other solutions to the issue.
  The key is to have some form of communication prior to setting up the shared memory.</p>