I am building a system where a script will start one process (suppose the process name is procA). This procA will in turn spawn another process (procB) through execv(). The environment is Linux and the coding language used is C/C++.
If the script content is "./procA &" means if procA is started in background, procB (which is spawned by procA) does not starts properly. That happens because procB while starting tries to get a semaphore, which it could not get and hangs there. This is the first place where it tries to get that semaphore so no possibility of the semaphore to be locked by someone else.
Even strange is, when the script content is "./procA" means procA is started in foreground, this problem does not arise and procB starts properly. Its also able to get that semaphore.
Can some one please help??