How to determine which is the parent process ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • webdevraj
    New Member
    • Jan 2008
    • 1

    How to determine which is the parent process ?

    Hi

    I had 2 process, eg(AProcess and BProcess). i am invokeing Bprocess from AProcess. How BProcess will determine or identify that Bprocess is invoked by AProcess or some other process. i need a solution that should be in C that can be implement in winodws or linux.

    Hope somebody will help me..

    thanks in adcance
    webdev raj
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by webdevraj
    Hi

    I had 2 process, eg(AProcess and BProcess). i am invokeing Bprocess from AProcess. How BProcess will determine or identify that Bprocess is invoked by AProcess or some other process. i need a solution that should be in C that can be implement in winodws or linux.

    Hope somebody will help me..

    thanks in adcance
    webdev raj

    Make sure that processA spawns the processB with a specified paramter and in processB check for that parameter.
    If it is of the same value then it means it is started by processA.

    Check whether this can help you.

    Raghuram

    Comment

    • rasmiranjanbabu
      New Member
      • Jan 2008
      • 3

      #3
      Originally posted by webdevraj
      Hi

      I had 2 process, eg(AProcess and BProcess). i am invokeing Bprocess from AProcess. How BProcess will determine or identify that Bprocess is invoked by AProcess or some other process. i need a solution that should be in C that can be implement in winodws or linux.

      Hope somebody will help me..

      thanks in adcance
      webdev raj

      If u r doing this program in Linux/UNIX,
      then the Parent Process ID(PPID) value is always less than the Child Process ID.
      U can use fork(), etc.
      There are so many System Calls are there.

      Comment

      Working...