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

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.