Quantcast
Channel: banana pi single board computer open source project official forum BPI team - Latest topics
Viewing all articles
Browse latest Browse all 6449

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

$
0
0

@sailaja_sailu wrote:

  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

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6449

Latest Images

Trending Articles



Latest Images