Lets say I use fork() twice to create child processes


(Sailaja Sailu) #1
  1. does Linux Kernel always send signals to parent process?

  2. lets say I use fork() twice to create child processes

    int main() {

    fork();

    fork();
    
    printf("hello\n");
    
    exit(0);
    

    }

after the first fork(), a child process(lets say it is called child_1, and the parent process is called parent_1) is created.

On the second fork(), child_1 create another child process (lets say it is called child_2).

so my understanding is, child_1 is actually a parent process in the context of child_2, so now lets say the shell runs the program and a user type ctrl-c at the keyboard, so the kernel sends the SIGINT, but to which process, parent_1 or child_1 or both, since child_1 is also parent process of child_2?

Thanks, Sailaja