Semaphore aquiring issue in a Process,which is spawned by other proc - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Semaphore aquiring issue in a Process,which is spawned by other proc

Hi,

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??

Thanks,
viv2012
Sign In or Register to comment.